시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 161 | 105 | 99 | 76.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.
xyzabcdefghijklmnopqrstuvw
3
aiemckgobjfndlhp
20
ICPC > Regionals > North America > Southeast USA Regional > 2016 Southeast USA Regional Programming Contest > Division 1 A번
ICPC > Regionals > North America > Pacific Northwest Regional > 2016 Pacific Northwest Region Programming Contest > Division 1 A번
ICPC > Regionals > North America > Pacific Northwest Regional > 2016 Pacific Northwest Region Programming Contest > Division 2 M번