atcoder#ABC227E. [ABC227E] Swap
[ABC227E] Swap
Score : points
Problem Statement
Given is a string consisting of K
, E
, Y
.
How many strings are there that can be obtained with at most swaps of two adjacent characters in ?
Constraints
- consists of
K
,E
,Y
.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
KEY
1
3
With at most one swap, there are three strings that can be obtained: KEY
, EKY
, KYE
.
KKEE
2
4
With at most two swaps, there are four strings that can be obtained: KKEE
, KEKE
, EKKE
, KEEK
.
KKEEYY
1000000000
90