FUP - Find Unchanged Position

no tags 

In this problem you have to take a string S as input, then sort the string lexicographically. That means you have to sort the string like (A..B..C..Z) in this pattern, then you have to find how many letters in string S remain same position after sorting. String S can contain only uppercase letters and can not contain any space.

Input

Input contains several test cases. Each line contains a string S (1 <= length of S <= 50). Input is terminated by a line which contains ‘#’.

Output

For each test case print an integer number that denote how many letters in string S remain same position after sorting.

Example

Input:
HEIST
MAN
#

Output:
3
1

Explanation

First input “HEIST”, which becomes “EHIST” after sorting. Letters remaining in the same position: I, S, T - so the answer is 3.



Added by:Setu
Date:2014-11-05
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU