n sentences and a positive integer k are given. Each sentence is made up of lowercase English alphabet letters and spaces. The words in the sentences are separated by one or more spaces. From each sentence we take a single word and make a special sentence, so that any two words are separated by a single space. In the special sentence the first word is from the first sentence, the second word is from the second sentence, ..., the last word is from the last sentence.
Task
Determine a special sentence made up of exactly k characters.
Input Data
Input file prop.in contains on line one positive integers n and k, separated by a space, and on the following n lines the sentences (each sentence on one line).
Output Data
Output file prop.out will contain a single line with the requested sentence or digit 0, if there is no solution.
Constraints and Statements
prop.in | prop.out |
3 13 |
merge dina cu |
Time limit: 0.1 seconds/test
prof. Doru Popescu Anastasiu
"Radu Greceanu" National College Slatina
Contact:dopopan@yahoo.com