11 May PMCA Sunday 10:00 Practice -05.09
Numerous local and international recreational runners were eager to take part in this year’s Zagreb Marathon! It is an already traditional race 42125 meters long. A curious statistical info is that this year every single contestant managed to complete the race, except one.
Since marathons are all about taking part, help the organizers figure out, based on the list of registered contestants and ranking list, the identity of the contestant that did not complete the race.
The first line of input contains the integer N (1≤N≤100000), the number of contestants.
Each of the following N lines contains the names of registered contestants.
The additional N−1 lines contain the names of contestants in the order which they completed the race.
The contestants’ names will consist of at least one and at most twenty lowercase letters of the English alphabet.
The contestants’ names won’t necessarily be unique.
The first and only line of output must contain the name of the contestant who didn’t finish the race.
Sample Input 1 3 leo kiki eden eden kiki Sample Output 1 leo Sample Input 2 5 marina josipa nikola vinko filipa josipa filipa marina nikola Sample Output 2 vinko Sample Input 3 4 mislav stanko mislav ana stanko ana mislav Sample Output 3 mislav
Question 2 (Optional Question):
Little Marin spent all his day generating test data for COCI. He simply couldn’t make it work, so he had a nervous breakdown and can’t even see clearly anymore. Every time he blinks while reading, the letters in a word get mixed up so that the letters from the second half of the word (the shorter half, if the length is an odd number) “jump in” between the letters from the first half in the following way:
- the last letter “jumps in” between the first and the second letter
- the penultimate letter “jumps in” between the second and the third letter
- the kth letter from the end “jumps in” between the kth and the (k+1)th letter from the beginning
For example, the word
abcdef would become
afbecd after blinking.
If Marin blinks again, the same thing happens. After two blinks, the word
Marin has decided to write a program to help him determine what’s exactly written on the screen. Unfortunately, after a day’s work, he’s simply too tired and he needs your help. You are given X, the number of blinks, and the word Marin sees on the screen. Write a program to solve the mystery for Marin and determine what was actually the word before he blinked X times.
The first line of input contains a positive integer X (1≤X≤1000000000), the number of times Marin blinked.
The second line of input contains the word from the screen, its length being from the interval [3,1000].
The word will consist only from small letters of English alphabet.
The first and only line of output must contain the original word, before Marin blinked X times.
Sample Input 1 4 acefdb Sample Output 1 abcdef Explanation for Sample Output 1 The word gets altered in the following order: abcdef,afbecd,adfcbe,aedbfc,acefdb. Sample Input 2 1000 aaaaaa Sample Output 2 aaaaaa Sample Input 3 11 srama Sample Output 3 sarma
Sorry, the comment form is closed at this time.