Problems
10170 - A Night With A Detective
SUBMIT PROBLEM

A Night With A Detective

Time Limit: 3 sec

 

The Problem

It was a very dark night when this happened. Mr. Kartik was killed in his own hotel room. His room was locked from inside. Mr. Felu Bond, the famous detective who never fails in solving his cases has been called to solve this one. His seventh sense never misses anything ever. But this one is a lot harder than anyone can think. No sign of anything except a tiny book. He discovered the book from Kartik’s book pocket. Who knows! May be killer killed him for this book. Or Kartik may had written anything that will hang the killer to death. The book had lines of words. These are totally meaningless. Or are they?

 

There are patterns that Felu Bond didn’t slip to notice. 

* There are multiple lines in the book

* Each line starts with an integer N. Mr. Kartik didn’t start all lines from the same indent.

* After the integer there are multiple words containing any characters.

* Nth character of all words of the same line creates a hidden word. Any word that is shorter than N repeats itself to fulfill the requirement.

 

Now you must write a program to help Mr. Bond to decode the book quickly. 

 

The Input

There are multiple lines of input set. Each line starts with an integer N (0<N<100) follow the multiple words containing any characters. Each line doesn’t exceed 10000 words and each word doesn’t exceed more than 100 characters.

 

The Output

For every single line output will be a new line containing secret message (not longer than 10000 chars ) preceding with “Case T: ” where T denotes line number.

 

Sample Input

2 DFG! Gi HNJ KD
3 Every Beauty Has Rhymes ???

1 Spaces Are Dangerous

 

Sample Output

Case 1: FiND

Case 2: easy?

Case 3: SAD

 

 

Intra University Programming Contest - Winter 2019 [BGC Trust University Bangladesh]

Problem Setter: Saiful Islam Niloy