| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 7 초 (추가 시간 없음) | 1024 MB | 61 | 29 | 21 | 51.220% |
You are given a string s[1..n] consisting of the first 6 lowercase English letters between a and f. A substring is called even if every distinct letter in it appears an even number of times. For example, in abbacac there are 4 even substrings: abba, bb, acac, bbacac. If a same substring appears at different locations, they shall be counted multiple times, e.g. the string aaa has 2 even substrings aa.
You are to process q queries of the following two types:
a and f, change s[i] to x.The first line of input has a single string s[1..n] (1 ≤ n ≤ 2 · 105) consisting of letters between a and f.
The second line of input has a single integer q (1 ≤ q ≤ 2 · 105), the number of queries. Each of the next q lines gives one query:
a and f.There is at least one query of type 1.
For each type 1 query output the number of even substrings on a single line.
abbacac 8 1 1 7 2 5 a 1 4 6 1 1 7 2 6 b 1 2 6 1 5 7 1 1 1
4 2 6 4 0 0
ICPC > Regionals > North America > Mid-Atlantic Regional > 2021 Mid-Atlantic USA Regional Contest E번
ICPC > Regionals > North America > North Central North America Regional > 2021 North Central NA Regional Contest A번