Loading...

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

Kamenpopov avatar Kamenpopov 0 Точки

Programming Fundamentals Final Exam - 04 April 2020 Group 2 - 1. Password Reset

Получавам 16/100 в Judge и runtime errors, а във Visual Studio всичко се изпълнява правилно.

https://pastebin.com/5H7FdyRG

Write a password reset program that performs a series of commands upon a predefined string. First, you will receive a string and afterwards, until the command "Done" is given, you will be receiving strings with commands split by a single space. The commands will be the following:

  • TakeOdd
    •  Takes only the characters at odd indices and concatenates them together to
      obtain the new raw password and then prints it.
  • Cut {index} {length}
    • Gets the substring with the given length starting from the given index from the password and removes its first occurrence of it, then prints the password on the console.
    • The given index and length will always be valid.
  • Substitute {substring} {substitute}
    • If the raw password contains the given substring, replaces all of its
      occurrences with the substitute text given and prints the result.
    • If it doesn’t, prints "Nothing to replace!"

Input

  • You will be receiving strings until the "Done" command is given.

Output

  • After the "Done" command is received, print:
    • "Your password is: {password}"

Constraints

  • The indexes from the "Cut {index} {length}" command will always be valid.

Examples

Input

Output

Siiceercaroetavm!:?:ahsott.:i:nstupmomceqr

TakeOdd

Cut 15 3

Substitute :: -

Substitute | ^

Done

icecream::hot::summer

icecream::hot::mer

icecream-hot-mer

Nothing to replace!

Your password is: icecream-hot-mer

Comments

TakeOdd

Siiceercaroetavm!:?:ahsott.:i:nstupmomceqr -> icecream::hot::summer

We only take the chars at odd indices 1, 3, 5 etc.

Cut 15  3 -> icecream::hot::summer -> sum

icecream::hot::mer

We cut a substring starting at index 15 with length 3,

remove it from the raw password and print it.

Then, on a new line we print the resulting new raw password.

Substitute :: - -> icecream::hot::summer -> icream-hot-summer

We replace "::" with "-".

Substitute | ^ -> Nothing to replace!

"|" is not found anywhere in the raw password.

Finally, after receiving the "Done" command, we print the resulting password in the proper format.

Input

Output

up8rgoyg3r1atmlmpiunagt!-irs7!1fgulnnnqy

TakeOdd

Cut 18 2

Substitute ! ***

Substitute ? .!.

Done

programming!is!funny

programming!is!fun

programming***is***fun

Nothing to replace!

Your password is: programming***is***fun

Тагове:
0
Fundamentals Module 08/04/2020 16:09:51
TheresaP avatar TheresaP 1 Точки

The aim of this course is to develop a foundation in computer programming, with a particular focus on engineering queries and applications. Here you can check my-assignment.help and get to learn more update about the thesis. Computer programming is considered part of engineering and therefore relates to the environment according to engineering requirements.

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