Nero's Key Board
时间限制: 500 ms 内存限制: 65536 kb
总通过人数: 0 总提交人数: 0
Description
Normally when we type in keyboard, character can be either upper-cased or lower-cased. and the way we type upper-cased letter is by pressing CAP or SHIFT.
Assuming we need to type a sequence of character, and we would like to find out the minimum number of clicks to type out sequence of characters.
The rules to calculate clicks is as follows:
- 1. one character + 1
- 2. one CAP + 1
- 3. one SHIFT + 1
General rules:
- 1. at the beginning, we all start by type letters in lower-cased
- 2. one click on CAP will change all the following letters to upper-cased unless press on CAP again
- 3. one SHIFT only will make the next letter to be upper-cased.
Constraints:
- 1. input is always valid, only $[a-zA-Z]$
- 2. input is never empty
- 3. 1 <= length <= $2000$.
Input format
a single string in each following lines, standing for a single test case
Output format
an integer
Sample Input 1
aaa
Sample Output 1
3
Sample input 2
aAa
Sample Output 2
4
Sample Input 3
aAAAAAAAa
Sample Output 4
11