A string problem Codeforces
A string problem Codeforces
|
NguyenDucHien | Logout
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP
PROBLEMS SUBMIT CODE MY SUBMISSIONS STATUS HACKS ROOM STANDINGS CUSTOM INVOCATION
You are given a string s consisting of lowercase Latin characters. Count the number of
nonempty strings t ≠ "a" such that it is possible to partition† s into some substrings satisfying → Submit?
the following conditions:
† Choose
A partition of a string s is an ordered sequence of some k strings t1 , t2 , … , tk (called Choose File No file chosen
file:
substrings) such that t1 + t2 + … + tk = s, where + represents the concatenation Be careful: there is 50 points penalty for
operation. submission which fails the pretests or
resubmission (except failure on the first test,
denial of judgement or similar verdicts).
Input "Passed pretests" submission verdict doesn't
4 guarantee that the solution is absolutely
The first line contains a single integer t (1 ≤ t ≤ 10 ) — the number of test cases. correct and it will pass system tests.
The only line of each test case contains a string s consisting of lowercase Latin characters ( Submit
2 ≤ |s| ≤ 2 ⋅ 105 ).
5
The sum of |s| over all test cases does not exceed 3 ⋅ 10 .
→ Score table
Output Score
For each test case, output a single integer — the number of nonempty strings t ≠ "a" that
Problem A 446
satisfy all constraints.
Problem B 668
Example Problem C1 668
input Copy Problem C2 1114
8 Problem D 2227
aaaaa
baba Problem E 2672
cabacb Problem F 2672
aaabaaa
bitset Problem G 3563
ab
Problem H 4454
abbaaaabbb
yearnineteeneightyfour Successful hack 100
1
2
3
1
Note
In the first test case, t can be "aa ", "aaa", "aaaa", or the full string.
In the second test case, t can be "b", "bab", "ba ", or the full string.
In the third test case, the only such t is the full string.
https://codeforces.com/contest/1984/problem/D 1/2
6/9/24, 10:16 PM Problem - D - Codeforces
Codeforces (c) Copyright 2010-2024 Mike Mirzayanov
The only programming contests Web 2.0 platform
Server time: Jun/09/2024 22:16:05UTC+7 (j2).
Desktop version, switch to mobile version.
Privacy Policy
Supported by
https://codeforces.com/contest/1984/problem/D 2/2