PECOSSTR - PECOS STRING
As many of you are not aware of the Pecos, let me introduce him. Pecos is the Jerry's guitar playing Uncle with a henkerin's for Cat Whiskers.
Whenever a string of his guitar broke, he replace it with one the Tom's whiskers. Finding no other solution, Tom asks Uncle Pecos to let him play the music for him.
As Uncle Pecos is a creative mouse since his last life, he provide Tom his music notes, and ask him to play notes only at nth position. On noticing that it's very easy, he added that the Tom had to miss every nth note, from the notes which he is supposed to play.
Input
There are one test case per line. Test cases ends with a '-1' (qoutes for clarity). Each test case contains a number, n, followed by the musical notes, characters from [a-z] and is up to length of 1000, in the same line.
Output
For each test case, print the required note in separate line.
Example
Input: 3 abcdefghijklm 4 pqrstuvwxyzsm -1 Output: cfl sws
Explanation for Test Case # 1
abcdefghijklm
Initially Tom is supposed to play every note at 3*n (n ε Z+) position : cfil
But after the second restriction, he had to miss every 3*n' (n' ε Z+) note, so new notes are: cflAdded by: | abhiranjan |
Date: | 2010-11-18 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |