| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 85 | 61 | 55 | 72.368% |
A palindrome is a sequence of one or more characters that reads the same from the left as from the right. Z, TOT and MADAM are palindromes, but ADAM is not. Write a program that reads a sequence of strings and for each string determines the number of UNIQUE palindromes that are substrings of the original string and outputs all of the unique palindromes.
The input file consists of a number of strings (one per line). The strings being checked are one word strings that contain no spaces.
Output all of the unique palindromes. Output the unique palindromes in order based on length. If two palindromes have the same length output them in order of first occurrence in the original word. For input string ADAM, the UNIQUE palindromes are A, D, M and ADA so the output would be as follows :
4 - "A" "D" "M" "ADA"
Output the unique palindromes in order of occurrence in the original word, sorted by length.
MOM MADAM TOT ADAM
3 - "M" "O" "MOM" 5 - "M" "A" "D" "ADA" "MADAM" 3 - "T" "O" "TOT" 4 - "A" "D" "M" "ADA"