#ABC264D. [ABC264D] "redocta".swap(i,i+1)

[ABC264D] "redocta".swap(i,i+1)

提示:该题测试数据补录中,暂不支持评测提交。

No testdata at current.

No submission language available for this problem.

Score : 400400 points

Problem Statement

You are given a string SS that is a permutation of atcoder. On this string SS, you will perform the following operation 00 or more times:

  • Choose two adjacent characters of SS and swap them.

Find the minimum number of operations required to make SS equal atcoder.

Constraints

  • SS is a string that is a permutation of atcoder

Input

Input is given from Standard Input in the following format:

SS

Output

Print the answer as an integer.

catredo
8

You can make SS equal atcoder in 88 operations as follows: catredo →\rightarrow [ac]tredo →\rightarrow actre[od] →\rightarrow actr[oe]d →\rightarrow actro[de] →\rightarrow act[or]de →\rightarrow acto[dr]e →\rightarrow a[tc]odre →\rightarrow atcod[er] This is the minimum number of operations achievable.

atcoder
0

In this case, the string SS is already atcoder.

redocta
21