IBMOA #24
Find Minimum Operations
估计中等可在线判题
Given a non-empty string containing only a, b and c, you may insert characters at any position. Find the minimum number of insertions needed to turn it into a concatenation of one or more abc strings.
输入格式
One line containing the string, 1≤length≤100000.
输出格式
Output one integer, the answer.
样例 1
输入:
b
输出:
2
样例 2
输入:
aaa
输出:
6
样例 3
输入:
abcabc
输出:
0
样例说明
The examples give 2, 6 and 0 respectively.