eolymp
bolt
Try our new interface for solving problems
Problems

Alphabet

Alphabet

A string of lowercase letters is called alphabetical if deleting zero or more of its letters can result in the alphabet string "abcdefghijklmnopqrstuvwxyz".

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

Input

Contains a string s (1 ≤ |s| ≤ 50). It is guaranteed that s consists of lowercase ASCII letters a to z only.

Output

Print the minimum number of letters that must be inserted in order to make the string s alphabetical.

Time limit 1 second
Memory limit 128 MiB
Input example #1
xyzabcdefghijklmnopqrstuvw
Output example #1
3
Input example #2
aiemckgobjfndlhp
Output example #2
20
Source 2016 ACM North America - Pacific Northwest, Дивизион 1, Задача A