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

解题说明:此题事实上就是考察C++中的set,把输入处理好就可以。

#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include <set>
using namespace std; int main()
{
string s;
set<char> t;
while (cin>>s)
{
if (s[0]!='{')
{
t.insert(s[0]);
}
else if (s[1]!='}')
{
t.insert(s[1]);
}
}
cout<<t.size()<<endl;
return 0;
}

A. Anton and Letters的更多相关文章

  1. cf443A Anton and Letters

    A. Anton and Letters time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  2. Anton and Letters

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

  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. Libgdx开发ios游戏

    今天亲自尝试了LibGDX如何开发ios游戏, 必须条件: 1:mac操作系统,mac下必须安装Xcode     好像ios开发必须在mac操作系统下 2:mac下安装eclipse 3:eclip ...

  2. fourinone分布式缓存研究和Redis分布式缓存研究

    最近在写一个天气数据推送的项目,准备用缓存来存储数据.下面分别介绍一下fourinone分布式缓存和Redis分布式缓存,然后对二者进行对比,以供大家参考. 1  fourinone分布式缓存特性 1 ...

  3. AliCTF 2016

    上上周参加了阿里的CTF,靠着最后绝杀队伍有幸拿到了国内第一名,也顺利进入了XCTF Final.把自己做的几个题简单写了下,发出来也算个总结吧. PWN-FB 经典的null byte overfl ...

  4. 【数学三角恒等变幻】【HDU2552】三足鼎立

    Problem Description MCA山中人才辈出,洞悉外界战火纷纷,山中各路豪杰决定出山拯救百姓于水火,曾以题数扫全场的威士忌,曾经高数九十九的天外来客,曾以一剑铸十年的亦纷菲,歃血为盟,盘 ...

  5. HA高可用的搭建

    HA 即 (high available)高可用,又被叫做双机热备,用于关键性业务. 简单理解就是,有两台机器A和B,正常是A提供服务,B待命闲置,当A宕机或服务宕掉,会切换至B机器继续提供服务.常用 ...

  6. kafka中处理超大消息的一些考虑

    Kafka设计的初衷是迅速处理短小的消息,一般10K大小的消息吞吐性能最好(可参见LinkedIn的kafka性能测试).但有时候,我们需要处理更大的消息,比如XML文档或JSON内容,一个消息差不多 ...

  7. Hortonworks 用于做 Sentimental Analysis的Hiveddl.sql 文件

    The hiveddl.sql script has performed the following steps to refine the data: Converted the raw Twitt ...

  8. JavaScript模块化-require.js

    http://www.cnblogs.com/duanhuajian/archive/2013/01/04/2844151.html 原文:http://www.ruanyifeng.com/blog ...

  9. ios ColorLUT滤镜

    通过这种方格图片实现滤镜 代码: "CIFilter+ColorLUT.h" "CIFilter+ColorLUT.m" #import "CIFil ...

  10. JS时间戳与日期类型格式相互转换

    function datetime_to_unix(datetime){     var tmp_datetime = datetime.replace(/:/g,'-');     tmp_date ...