시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB1611059976.154%

문제

A string of lowercase letters is called alphabetical if some of the letters can be deleted so that the only letters that remain are the letters from `a' to `z' in order.

Given a string s, determine the minimum number of letters to add anywhere in the string to make it alphabetical.

입력

Each input will consist of a single test case. Note that your program may be run multiple times on different inputs. The only line of input contains a string s (1 ≤ |s| ≤ 50) which contains only lowercase letters.

출력

Output a single integer, which is the smallest number of letters needed to add to s to make it alphabetical.

예제 입력 1

xyzabcdefghijklmnopqrstuvw

예제 출력 1

3

예제 입력 2

aiemckgobjfndlhp

예제 출력 2

20