Codeforces 443A Anton and Letters(水题)

来源:互联网 发布:ubuntu更新软件的方法 编辑:程序博客网 时间:2024/05/16 06:47

题目链接:Codeforces 443A Anton and Letters

题目大意:给出一个字母的集合,问说有多少个不同的元素。

解题思路:水题。

#include <cstdio>#include <cstring>const int N = 1005;int n, v[N];char s[N];int main () {    int ans = 0;    memset(v, 0, sizeof(v));    gets(s);    n = strlen(s);    for (int i = 0; i < n; i++) {        if (s[i] >= 'A' && s[i] <= 'z') {            int u = s[i] - 'A';            if (v[u] == 0)                ans++;            v[u] = 1;        }    }    printf("%d\n", ans);    return 0;}
0 0