아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Palins

면접 대비

시간 제한1초메모리 제한1024 MB

요약
입력받은 각 단어에서 서로 다른 회문 부분 문자열을 모두 찾아 길이 순으로, 길이가 같으면 처음 나타난 순서로 출력한다.
난이도

보통10점 중 4점

유형
문자열, 해시맵, 완전 탐색
정답자
아직 제출이 없습니다

문제

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.

예제1

  1. 예제 1

    입력
    MOM
    MADAM
    TOT
    ADAM
    
    예상 출력
    3 - "M" "O" "MOM"
    5 - "M" "A" "D" "ADA" "MADAM"
    3 - "T" "O" "TOT"
    4 - "A" "D" "M" "ADA"