100 atcoder#ABC162D. [ABC162D] RGB Triplets
[ABC162D] RGB Triplets
Score : points
Problem Statement
We have a string of length consisting of R
, G
, and B
.
Find the number of triples that satisfy both of the following conditions:
- , , and .
- .
Constraints
- is a string of length consisting of
R
,G
, andB
.
Input
Input is given from Standard Input in the following format:
Output
Print the number of triplets in question.
4
RRGB
1
Only the triplet satisfies both conditions. The triplet satisfies the first condition but not the second, so it does not count.
39
RBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB
1800