atcoder#ABC264D. [ABC264D] "redocta".swap(i,i+1)
[ABC264D] "redocta".swap(i,i+1)
Score : points
Problem Statement
You are given a string that is a permutation of atcoder
.
On this string , you will perform the following operation or more times:
- Choose two adjacent characters of and swap them.
Find the minimum number of operations required to make equal atcoder
.
Constraints
- is a string that is a permutation of
atcoder
Input
Input is given from Standard Input in the following format:
Output
Print the answer as an integer.
catredo
8
You can make equal atcoder
in operations as follows:
catredo
[ac]tredo
actre[od]
actr[oe]d
actro[de]
act[or]de
acto[dr]e
a[tc]odre
atcod[er]
This is the minimum number of operations achievable.
atcoder
0
In this case, the string is already atcoder
.
redocta
21