Logo
(追記) (追記ここまで)

19008번 - Rikka with String 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
6 초 512 MB0000.000%

문제

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 $s$ of length $n$ which only contains lowercase English letters from "a" to "l" (there are 12ドル$ possible letters). You can choose a permutation of these 12ドル$ letters $p_{\texttt{a}}, p_{\texttt{b}}, \ldots, p_{\texttt{l}},ドル and then consider the string $t = p_{s_1} p_{s_2} \ldots p_{s_n}$. Your task is to check for each $i$ from 1ドル$ to $n$ whether the $i$-th suffix (the substring $t[i, n]$) can become the largest suffix of $t$ in lexicographical order after such modification.

입력

The first line contains a single integer $t$ (1ドル \leq t \leq 10^3$), the number of test cases.

Each test case is given on a separate line containing a string $s$ (1ドル \leq |s| \leq 10^5,ドル the string contains only lowercase English letters from "a" to "l").

It is guaranteed that there are at most 15ドル$ test cases with $|s| > 10^3$.

출력

For each test case, output a single line with a binary string of length $|s|$. If the $i$-th suffix can become the largest one, the $i$-th position must contain "1". Otherwise, it must contain "0".

제한

예제 입력 1

3
abaab
abcdefghijkllkjihgfedcba
aabbcccbaabcca

예제 출력 1

01100
111111111111011111111110
10101000100000

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2018 > Day 6: Ruyi Ji Contest 4 J번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /