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

  • 相关阅读:
    Python的一些版本分析
    2006年的长春.NET俱乐部
    大病了一场,不过闲时对AJAX探索时,实现了IE TREE无刷新
    关于AJAX开发
    提供可在WSS上使用的MYTREE
    关于WSS搜索的问题
    转发:使用JavaScript删除ASP.NET生成的HttpCookie
    AJAX(2)
    在将WEBPART打包成*.CAB包和*.MSI安装包后,竟然无法将其安装到指定的WSS网站
    转发:Session研习笔记
  • 原文地址:https://www.cnblogs.com/qscqesze/p/3896557.html
Copyright © 2011-2022 走看看