Защо Judge ми дава 83/100 на задача World tour и къде ми е грешката?
Ето моя код: https://pastebin.com/SRCu8zKe
Това е условието на задачата:
Programming Fundamentals Final Exam 09.08.2020
Problem 1. World Tour
You are a world traveller and your next goal is to make a world tour. In order to do that, you have to plan out everything first. To start with, you would like to plan out all of your stops where you will have a break.
On the first line you will be given a string containing all of your stops. Until you receive the command "Travel", you will be given some commands to manipulate that initial string. The commands can be:
- Add Stop:{index}:{string} – insert the given string at that index only if the index is valid
- Remove Stop:{start_index}:{end_index} – remove the elements of the string from the starting index to the end index (inclusive) if both indices are valid
- Switch:{old_string}:{new_string} – if the old string is in the initial string, replace it with the new one. (all occurrences)
Note: After each command print the current state of the string
After the "Travel" command, print the following: "Ready for world tour! Planned stops: {string}"
Input / Constraints
- JavaScript: you will receive a list of strings
Output
- Print the proper output messages in the proper cases as described in the problem description
Examples
Input |
Output |
Hawai::Cyprys-Greece Add Stop:7:Rome Remove Stop:11:16 Switch:Hawai:Bulgaria Travel |
Hawai::RomeCyprys-Greece Hawai::Rome-Greece Bulgaria::Rome-Greece Ready for world tour! Planned stops: Bulgaria::Rome-Greece |
JS Input / Output
Input |
Output |
[("Hawai::Cyprys-Greece", "Add Stop:7:Rome", "Remove Stop:11:16", "Travel"]) |
Hawai::RomeCyprys-Greece Hawai::Rome-Greece Bulgaria::Rome-Greece Ready for world tour! Planned stops: Bulgaria::Rome-Greece |
Благодаря много.
Моля.