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
{a, b, c}
output
3
input
{b, a, b, a}
output
2
input
{}
output
0

模拟没什么可说的

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
bool mark[27];
int ans;
int main()
{
char ch;
while (1)
{
while ((ch!='}')&&(ch<'a'||ch>'z')) scanf("%c",&ch);
if (ch=='}') break;
if (!mark[ch-'a'])
{
mark[ch-'a']=1;
ans++;
}
ch=' ';
}
printf("%d",ans);
}

  

cf443A Anton and Letters的更多相关文章

  1. Anton and Letters

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

  2. A. Anton and Letters

    time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...

  3. Y - Anton and Letters

    Problem description Recently, Anton has found a set. The set consists of small English letters. Anto ...

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

    题目很简单,只需要注意带空格的输入用getline即可 #include <iostream> #include <vector> #include <algorithm ...

  5. Codeforces Round 253 (Div. 2)

    layout: post title: Codeforces Round 253 (Div. 2) author: "luowentaoaa" catalog: true tags ...

  6. Codeforces Round #379 (Div. 2) A. Anton and Danik 水题

    A. Anton and Danik 题目连接: http://codeforces.com/contest/734/problem/A Description Anton likes to play ...

  7. C - Anton and Danik

    Problem description Anton likes to play chess, and so does his friend Danik. Once they have played n ...

  8. 【77.39%】【codeforces 734A】Anton and Danik

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  9. [LeetCode] Remove Duplicate Letters 移除重复字母

    Given a string which contains only lowercase letters, remove duplicate letters so that every letter ...

随机推荐

  1. 关于XMLEncoder和XMLDecoder

    我们用XMLEncoder和XMLDecoder来序列化和反序列化一个类. 我觉得需要注意的是,我们在new一个对象的时候,XMLEncoder本身默认的是类中无参的构造函数,我今儿在实现的时候,老是 ...

  2. javascript算法挑战

    1.翻转字符串算法挑战: 先把字符串转化成数组,再借助数组的reverse方法翻转数组顺序,最后把数组转化成字符串. 你的结果必须得是一个字符串 function reverseString(str) ...

  3. 类型兼容原则(C++)

    类型兼容原则是指在需要基类对象的任何地方,都可以使用公有派生类的对象来替代. 通过公有继承,派生类得到了基类中除构造函数.析构函数之外的所有成员.这样,公有派生类实际具备了基类的所有功能,凡是基类能解 ...

  4. 关于IE7 兼容问题

    关于a标签的写法(目前测试只针对IE7,IE8及谷歌浏览器): <a  onclick = 方法名(参数);></a>  此写法在 IE8以上及谷歌浏览器使用都没有问题,但在I ...

  5. [每日一题] 11gOCP 1z0-052 :2013-09-3 Because of frequent checkpoints...........................A30

    转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/11022433 正确答案:BC 这里我就偷一下懒了,引用 http://www.itpub. ...

  6. Python-elementTree方法解析xml文件-01

    [XML基本概念介绍] XML 指可扩展标记语言(eXtensible Markup Language). XML 被设计用来传输和存储数据.概念一: <foo> # foo元素的起始标签 ...

  7. ComboBox( 下拉列表框)

    一. 加载方式//class 加载方式<select id="box" class="easyui-combobox" name="box&qu ...

  8. ExtJs在vs中的应用

    目标: 认识EXTJS(自己google) 在vs中创建EXTJS的编程环境 通过一个简单的例子了解EXTJS编程过程 内容: 个人理解EXTJS是一个基于ajax富客户端应用程序框架, 1,创建vs ...

  9. CodeFirst解决数据迁移问题

    CodeFirst解决数据迁移问题 分类: 数据库 设计模式 c#2013-04-24 17:56 137人阅读 评论(0) 收藏 举报 工程用的MVC + Entity Framework,根据Co ...

  10. poj 1182 并查集高级应用

    C - 是谁站在食物链的顶端 Crawling in process... Crawling failed Time Limit:1000MS     Memory Limit:10000KB     ...