Post's Correspondence Problem
시간 제한: 1000ms메모리 제한: 128MB출처: CCC 2001 SeniorBOJ 6935
문제
Let and be two sequences of non-empty strings:
Let be a positive integer. Does there exist a sequence of integers such that and ?
For example, if and , then the required sequence of integers is giving .
입력
The first two lines of input will contain and respectively, and . The next lines contain in order the elements of followed by the elements of . Each string is at most characters.
출력
If a solution exists, print on a line by itself, followed by the integer sequence in order, one element per line. Otherwise, print a single line containing No solution..
예제
예제 1
입력
7 3 a abaaa ab aaa ab b
출력
4 2 1 1 3
예제 2
입력
10 3 abc def ghi bcd efg hia
출력
No solution.
이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.