Codeforces Round #253 (Div. 2) A. Anton and Letters

Codeforces Round #253 (Div. 2)

A. Anton and Letters
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Recently, Anton has found a set. The set consists of small English letters. Anton carefully wrote out all the letters from the set in one line, separated by a comma. He also added an opening curved bracket at the beginning of the line and a closing curved bracket at the end of the line.

Unfortunately, from time to time Anton would forget writing some letter and write it again. He asks you to count the total number of distinct letters in his set.

Input

The first and the single line contains the set of letters. The length of the line doesn't exceed 1000. It is guaranteed that the line starts from an opening curved bracket and ends with a closing curved bracket. Between them, small English letters are listed, separated by a comma. Each comma is followed by a space.

Output

Print a single number — the number of distinct letters in Anton's set.

Sample test(s)
input
output
input
output
input
output
0

 1 #include<iostream>  

 2 #include<string.h>  

 3 #include<stdio.h>  

 4 #include<ctype.h>  

 5 #include<algorithm>  

 6 #include<stack>  

 7 #include<queue>  

 8 #include<set>  

 9 #include<math.h>  

10 #include<vector>  

11 #include<map>  

12 #include<deque>  

13 #include<list>  

14 using namespace std;

15 int v[10000];

16 int main()

17 {

18     memset(v,0,sizeof(v));

19     char s[10000];

20     int ans=0;

21     gets(s);

22     int n=strlen(s);

23     for(int i=0;i<n;i++)

24     if(s[i]>'A'&&s[i]<'Z')

25     {

26         int u=s[i]-'A';

27         if(v[u]==0)

28         {

29             ans++;

30             v[u]=1;

31         }

32     }

33     cout<<ans;

34 } 
View Code

 


你可能感兴趣的:(codeforces)