#abc162d. [abc162_d]RGB Triplets
[abc162_d]RGB Triplets
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.
Sample Input 1
4
RRGB
Sample Output 1
1
Only the triplet satisfies both conditions. The triplet satisfies the first condition but not the second, so it does not count.
Sample Input 2
39
RBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB
Sample Output 2
1800