Palins
면접 대비시간 제한1초메모리 제한1024 MB
입력받은 각 단어에서 서로 다른 회문 부분 문자열을 모두 찾아 길이 순으로, 길이가 같으면 처음 나타난 순서로 출력한다.
문제
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.