[Codeforces443A]Anton and Letters

描述 Description

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.

输入格式 InputFormat

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.

输出格式 OutputFormat

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

样例输入 SampleInput

{b, a, b, a, b, c, c, b, c, b}

3

Codeforces 443A

代码 Code

``````#include <stdio.h>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
int a[500];
int i,j,t,n,m,l,r,k,z,y,x;
char ch;
int main()
{
memset(a,0,sizeof(a));
ch=getchar();
while (ch!='}')
{
a[ch]++;
ch=getchar();
}
z=0;
for (i='a';i<='z';i++) if (a[i]>0) z++;
printf("%d\n",z);
return 0;
}``````