zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    solr 最佳实践
    DNS 域名解析过程
    mac 下 virtualbox 配置全网通
    搜索引擎使用技巧
    三叉搜索树
    双数组trie树的基本构造及简单优化
    基于回归-马尔科夫模型的客运量预测
    solr 常用命令
    PHP yield 分析,以及协程的实现,超详细版(上)
    C语言,简单计算器【上】
  • 原文地址:https://www.cnblogs.com/qscqesze/p/3896557.html
Copyright © 2011-2022 走看看