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

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

Spaces

면접 대비

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

요약
단어 사전과 공백이 모두 사라진 문자열이 주어질 때, 모든 조각이 사전 단어가 되도록 공백을 넣고 그 위치를 출력한다.
난이도

보통10점 중 5점

유형
동적 계획법, 문자열
정답자
아직 제출이 없습니다

문제

For some reason, when Paul’s essay was saved, all of the spaces disappeared. He does not want to re-add all of his spaces so he decided to make a program that will, given a dictionary of words, add the spaces in the right places. There will only be one configuration of spaces that will correctly separate the words.

입력

The first line of input will contain a single integer n that indicates the number of words in the dictionary.

The following n lines will be the words that are in the dictionary of possible words.

The rest of the input will be the collection of characters that must be spaced out correctly. In the data file this will be on one line.

출력

Output the zero-based index positions of the spaces in the final essay.

예제1

  1. 예제 1

    입력
    12
    there
    is
    nothing
    i
    an
    and
    a
    the
    now
    know
    sure
    do
    thenowisnothingandisuredoknowtheis
    
    예상 출력
    3 7 10 18 22 24 29 32 37 41