Contact List from MidExam June
Здравейте,
може ли да помоля за помощ за следната задача при която получавам 90/100 точки.
решението и условието:
https://judge.softuni.bg/Contests/Practice/Index/1682#2
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.
-
ePrint the list after the manipulations upon the "Print" command in the format described above.
Examples
Благодаря ти много за отговора!
Успех :)