Loading...

Във форума е въведено ограничение, което позволява на потребителите единствено да разглеждат публикуваните въпроси.

razihanna avatar razihanna 7 Точки

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}"
  • "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 [-5050]

 

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!

 

Тагове:
0
Fundamentals Module
svephoto avatar svephoto 1191 Точки

Hi, razihanna,

 

You have some things to fix, for example: you don't have check for the ending command "Finish"; you don't need if (true) inside the while-loop; when printing you don't need $ before simple string expression without placeholders, etc.

0
02/04/2021 21:11:05
razihanna avatar razihanna 7 Точки

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.

0
svephoto avatar svephoto 1191 Точки

OK, that's good, you are welcome.

0
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.