Rikka with String
시간 제한6초메모리 제한512 MB
12개 소문자로 이루어진 문자열의 각 접미사마다, 12개 문자의 순열을 재배치해 그 접미사가 사전순으로 가장 큰 접미사가 될 수 있는지 판정한다.
문제
This is the last problem of this contest, so Rikka doesn't want to add a lengthy background to it. Let us make all the things simple and clear.
You have a string of length which only contains lowercase English letters from "a" to "l" (there are possible letters). You can choose a permutation of these letters , and then consider the string . Your task is to check for each from to whether the -th suffix (the substring ) can become the largest suffix of in lexicographical order after such modification.
입력
The first line contains a single integer (), the number of test cases.
Each test case is given on a separate line containing a string (, the string contains only lowercase English letters from "a" to "l").
It is guaranteed that there are at most test cases with .
출력
For each test case, output a single line with a binary string of length . If the -th suffix can become the largest one, the -th position must contain "1". Otherwise, it must contain "0".