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. UIView 弹出动画

    // 展开动画 - (void)beginAnimations { CGContextRef context = UIGraphicsGetCurrentContext(); [UIView begi ...

  2. 布局文件提示错误“No orientation specified, and the default is horizontal. This is a common so...”

    完整的错误提示信息为:No orientation specified, and the default is horizontal. This is a common source of bugs ...

  3. Android应用程序窗口(Activity)的测量(Measure)、布局(Layout)和绘制(Draw)过程分析

    文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/8372924 在前面一篇文章中,我们分析了And ...

  4. ueditor+asp.net异步提交,可以实现了,嘿嘿

    之前没用过Ueditor去异步提交,最近项目需要用到这个,就下了个来用,结果可能没仔细去看Ueditor的相关介绍文档,然后自己也郁闷了一下才把它弄出来,现在可以实现异步提交了,松口气,把代码贴出来, ...

  5. SQL Server 2008 修改表名

     有一张表  修改起 if exists (select * from sys.objects where object_id = object_id(N'Table_1') and type in ...

  6. asp.net + Jquery 实现类似Gridview功能 (一)

    不知不觉2015年就过去一半了,由于过年前后公司人员陆续离职(这个...),项目忙不过来,从过年来上班就一直在忙,最近项目终于告一段落,开始步入正轨(不用天天赶项目了).所以最近才有时间写这个东西,可 ...

  7. Android_xml背景色的值

    点击(此处)折叠或打开 <?xml version="1.0" encoding="utf-8" ?> <resources> < ...

  8. Mac下Apache服务器配置

    一.Apache服务器 1. 使用最广的 Web 服务器 2. Mac自带,只需要修改几个配置就可以,简单,快捷 3. 有些特殊的服务器功能,Apache都能很好的支持 目的:让有一个自己专属的测试环 ...

  9. stringstream函数(i o)

    stringstream函数 头文件  #include<sstream> stringstream是字符串流,被用来切分数据或转化类型 样例一(摘) 输入n,代表接下来输入n行资料,每行 ...

  10. 【搜索引擎Jediael开发笔记3】使用HtmlParser提取网页中的链接

    关于HtmpParser的基本内容请见 HtmlParser基础教程 本文示例用于提取HTML文件中的链接 package org.ljh.search.html; import java.util. ...