Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Passwords

Limits: 1s, 512 MB

Alice wants to extract some passwords from a random string. A password can have any number of characters but it must contain at least one lowercase letter, one uppercase letter and a digit. She is looking at the string from left to right, and whenever she thinks she got a new password, she stores it in her database and starts checking from next character.

Given the string, can you determine how many passwords Alice will be able to extract from it?

Input

Each line will contain a string consisting only english alphabets and digits. The length of the string will be between 1 and 100. Read input till EOF.

Output

For each string print number of passwords Alice can extract from it.

Samples

InputOutput
hello1World2X
aBAb222abD32Gggp
aasdafsdfDSF
2
3
0

In the first case, the extracted passwords are “hello1W” and “orld2X”

In the second case, the extracted passwords are “aBAb2”, “22abD”,”32Gg”

In the third case there are no digits, so no password can be extracted.

Author
Discussion
Submit

Login to submit