1. Nikuldens Charity C#
Hello,
Regarding this problem
Programming Fundamentals Final Exam - 07 December 2019 Group 2 - SoftUni Judge
I got 0/100, all test are with Runtime error
My code using System;namespace Nikulden_s_Charity{ class Program { - Pastebin.com
I am not sure why,
Will apprecaite any help
Thakn you
Nikulden’s Charity
After his name day party, Nikolcho wants to find out how much money he has raised for charity. He received an encrypted message with the amount collected. Your task is to help Nikolcho to figure out how much money he has collected.
First, you are going to receive a string, then commands.
You will receive "decrypting" commands until you get the "Finish" command.
- "Replace {currentChar} {newChar}"
- Replace all occurrences of {currentChar} with {newChar}, then print the current message.
- "Cut {startIndex} {endIndex}"
- Remove the substring from the {startIndex} until the {endIndex}, then print the current message.
- If any of the indexes is not valid, print:
"Invalid indexes!"
- "Make {Upper/Lower}"
- Replace all letters with upper/lower case and print the current message
- "Check" {string}
- Check if the message contains the given string.
- If it does, print: "Message contains {string}"
- If it doesn’t, print: "Message doesn't contain {string}"
- Check if the message contains the given string.
- "Sum {startIndex} {endIndex}"
- Get the substring from {startIndex} to {endIndex} and print the sum of the ASCII values of the substring.
- If any of the {startIndex} or {endIndex} are invalid, print:
"Invalid indexes!"
Note: At any time, the message will contain at least one character.
Input
- On the 1st line you are going to receive the string.
- On the next lines, until the "Finish" command is received, you will be receiving commands.
Output
- Print the output of every command in the format described above.
Constraints
- The indexes will be integers in the range [-50…50]
Examples
Input |
Output |
ILikeSharan Replace a e Make Upper Check SHEREN Sum 1 4 Cut 1 4 Finish |
ILikeSheren ILIKESHEREN Message contains SHEREN 293 ISHEREN |
Input |
Output |
HappyNameDay Replace p r Make Lower Cut 2 23 Sum -2 2 Finish |
HarryNameDay harrynameday Invalid indexes! Invalid indexes! |
Thank you for your reply.
I found the mistake , it is in line 19, I don't know how I wrote if(true) , I think i paste it by mistake.
It should be
if (input == "Finish")
{
break;
}
Thank you verymuch.
OK, that's good, you are welcome.