Problem 1. Activation Keys-Programming Fundamentals Final Exam
Здравейте! Кодът ми получава 85/100. Интересното е, че се чупи на 2рия тест, а в word документа, където е условието, моят код е правилен,а в джъдж се разминава едната буква. Ще бъда благодарен, ако някой открие грешката ми.
Благодаря предварително!
Моят код:https://pastebin.com/Cq6KPmyc
Линк към judge:https://judge.softuni.bg/Contests/Practice/Index/2302#0
Условие:
Programming Fundamentals Final Exam 04.04.2020
Problem 1. Activation Keys
You are about to make some good money, but first you need to think of a way to verify who paid for your product and who didn`t. You have decided to let people use the software for a free trial period and then require an activation key in order to continue to use the product. The last step before you could cash out is to design a program that creates unique activation keys for each user. So, waste no more time and start typing!
The first line of the input will be your raw activation key. It will consist of letters and numbers only.
After that, until the "Generate" command is given, you will be receiving strings with instructions for different operations that need to be performed upon the raw activation key.
There are several types of instructions, split by ">>>":
- Contains>>>{substring} – checks if the raw activation key contains the given substring.
- If it does prints: "{raw activation key} contains {substring}".
- If not, prints: "Substring not found!"
- Flip>>>Upper/Lower>>>{startIndex}>>>{endIndex}
- Changes the substring between the given indices (the end index is exclusive) to upper or lower case.
- All given indexes will be valid.
- Prints the activation key.
- Slice>>>{startIndex}>>>{endIndex}
- Deletes the characters between the start and end indices (end index is exclusive).
- Both indices will be valid.
- Prints the activation key.
Input
- The first line of the input will be string and it will consist of letters and numbers only.
- After the first line, until the "Generate" command is given, you will be receiving strings.
Output
- After the "Generate" command is received, print:
- "Your activation key is: {activation key}"
Examples
Input |
Output |
abcdefghijklmnopqrstuvwxyz Slice>>>2>>>6 Flip>>>Upper>>>3>>>14 Flip>>>Lower>>>5>>>7 Contains>>>def Contains>>>deF Generate |
abghijklmnopqrstuvwxyz abgHIJKLMNOPQRstuvwxyz abgHIjkLMNOPQRstuvwxyz Substring not found! Substring not found! Your activation key is: abgHIjkLMNOPQRstuvwxyz |
Comments |
|
abcdefghijklmnopqrstuvwxyz becomes abghijklmnopqrstuvwxyz
abghijklmnopqrstuvwxyz becomes abgHIJKLMNOPQRstuvwxyz
abgHIJKLMNOPQRstuvwxyz becomes abgHIjkLMNOPQRstuvwxyz
abgHIjkLMNOPQRstuvwxyz does not contain def
abgHIjkLMNOPQRstuvwxyz does not contain deF The final activation key is abgHIjkLMNOPQRstuvwxyz |
|
Input |
Output |
134softsf5ftuni2020rockz42 Slice>>>3>>>7 Contains>>>-rock Contains>>>-uni- Contains>>>-rocks Flip>>>Upper>>>2>>>8 Flip>>>Lower>>>5>>>11 Generate |
134sf5ftuni2020rockz42 Substring not found! Substring not found! Substring not found! 134SF5FTuni2020rockz42 134SF5ftuni2020rockz42 Your activation key is: 134SF5ftuni2020rockz42 |
Колега,
И аз получих същия резултат, но при преглед на условието установих, че при изход примерен "Veselin contains lin." не трябва да има точка накрая. След това изкара 100/100.