| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 91 | 72 | 65 | 83.333% |
You are given a string $s$ consisting of lowercase English letters. Your task is to split $s$ into a sequence of non-empty substrings such that no two adjacent substrings in the sequence are anagrams of each other. (Two strings are considered anagrams if they contain the same characters with the same frequencies.) Among all such valid splits, you must maximize the number of substrings.
The first line of the input contains a single integer $T,ドル the number of test cases.
The following $T$ lines each describe a test case. Each line contains a single string $s$ consisting of lowercase English letters.
For each test case, print a single integer on a new line: the maximum possible number of substrings in a valid split.
5 kaist rrunnn iiccppcc mooockk connttest
5 4 6 5 8
8 a bb ccc dddd eeeee ffffff ggggggg hhhhhhhh
1 1 2 3 3 4 5 5
4 brainpowerletthebasskick oooooooooooaaaaeaaiau joooooooooooooaaeoaauua eeeeeeeeeaaaaeaeiea
22 15 17 15
University > KAIST > KAIST ICPC Mock Competition > 2025 KAIST 15th ICPC Mock Competition B번
University > MIT > The MIT Programming Contest > 2025-26 > MIT Team Contest 2 B번