Задача Contact List
Здравейте, колеги! Не мога да разбера къде греша в следната задача:
Create a program that helps you keep track of the contacts that you have. You will receive the list of contacts you already have on a single line, separated by a single space in the following format:
"{contact1} {contact2} {contact3}… {contactn}"
Then you will receive commands that you need to execute over your list. There are four possible commands:
"Add {contact} {index}":
If {contact} isn’t already contained – add it in the end of the collection.
If {contact} is already contained – add it on the given index, if the index exists.
"Remove {index}"
Remove the contact on the given index, if the index exists.
"Export {startIndex} {count}":
Print the next {count} contacts starting from the given {startIndex} (including), separated by a single space. If the count requested is more than the contacts- just print them to the end.
"{contact} {contact} {contact}"
"Print Normal/Reversed"
Print the contact list in normal (in the order they have been added) or reversed order and then stop the program:
"Contacts: {contact1} {contact2}… {contactn}"
Input
On the 1st line, you will receive the starting list with the names of the contacts separated by a single space.
On the next lines, you will receive commands in the format described above.
Output
Print the needed output upon the "Export" command.
Print the list after the manipulations upon the "Print" command in the format described above.
В Judge получавам 90 точки.
Моят код е: https://pastebin.com/r84LJb8N
Линк към Judge: https://judge.softuni.bg/Contests/Practice/Index/1682#2
Здравей! Всъщност аз тази задача я бях забравил, че не съм успял да я докарам до 100 точки и твоят въпрос ме подсети да я погледна пак и пак да се опитам. В крайна сметка успях и наистина проблемът при мен беше в export командата. Заповядай код, който дава 100 точки: https://pastebin.com/7gRDeJvu