Y - Anton and Letters
Problem description
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.
Examples
Input
{a, b, c}
Output
3
Input
{b, a, b, a}
Output
2
Input
{}
Output
0
解题思路:统计花括号中不同字母的个数,set容器水过!
AC代码:
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;set<char> se;
getline(cin,s);
for(int i=;s[i]!='\0';++i)
if(s[i]>='a'&&s[i]<='z')se.insert(s[i]);
cout<<se.size()<<endl;
return ;
}
Y - Anton and Letters的更多相关文章
- cf443A Anton and Letters
A. Anton and Letters time limit per test 2 seconds memory limit per test 256 megabytes input standar ...
- Anton and Letters
Anton and Letters time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- A. Anton and Letters
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- Codeforces Round #253 (Div. 2) A. Anton and Letters
题目很简单,只需要注意带空格的输入用getline即可 #include <iostream> #include <vector> #include <algorithm ...
- Codeforces Round 253 (Div. 2)
layout: post title: Codeforces Round 253 (Div. 2) author: "luowentaoaa" catalog: true tags ...
- 数据分析---《Python for Data Analysis》学习笔记【03】
<Python for Data Analysis>一书由Wes Mckinney所著,中文译名是<利用Python进行数据分析>.这里记录一下学习过程,其中有些方法和书中不同 ...
- 【枚举】Consonant Fencity @upcexam5110
时间限制: 3 Sec 内存限制: 512 MB 题目描述 There are two kinds of sounds in spoken languages: vowels and consonan ...
- C 标准库 - ctype.h
C 标准库 - ctype.h This header declares a set of functions to classify and transform individual charact ...
- ZZ:Solaris 10 软件包分析
ZZ:Solaris 10 软件包分析 http://blog.chinaunix.net/uid-22759617-id-276756.html # Last updated: 2006-02-14 ...
随机推荐
- HDU 1907 John(博弈)
题目 参考了博客:http://blog.csdn.net/akof1314/article/details/4447709 //0 1 -2 //1 1 -1 //0 2 -1 //1 2 -1 / ...
- swap() 函数实现的方法
swap()函数总结: 一.利用临时变量 1.引用(交换任意类型) template <typename T> void swap(T& x,T& y) { T tmp; ...
- JAVA中对事物的理解
1.事物是一组操作数据的集合动作 (场景:再开发的时候相信大家都遇到主表和子表的插入问题,当主表插入成功时,子表没有插入成功,这时候我们就要把主表的数据回滚,这个时候我们就要用到事物了) 2.一组处理 ...
- i++与++i的区别及效率
i++与++i的区别及效率 先看看基本区别:i++ :先在i所在的表达式中使用i的当前值,后让i加1++i :让i先加1,然后在i所在的表达式中使用i的新值 看一些视频教程里面写for循环的时候都 ...
- 【 Codeforces Global Round 1 B】Tape
[链接] 我是链接,点我呀:) [题意] x轴上有m个连续的点,从1标号到m. 其中有n个点是特殊点. 让你用k段区间将这n个点覆盖. 要求区间的总长度最小. [题解] 一开始假设我们需要n个胶带(即 ...
- jenkins简单持续构建
一.安装jenkins 二.将需要持续构建的java project打包成jar文件 1.选择导出需要运行的main方法所在java类
- 清北学堂模拟赛d3t6 c
分析:比较神奇的一道题.要把树变成环肯定要先变成链,然后把链给拼接成环.接下来考虑一个脑洞大开的树形dp:设f[i][0]表示i不与父节点相连的链数,f[i][1]表示i与父节点相连的链数,先考虑怎么 ...
- 背包again
Gy最近学习了01背包问题,无聊的他又想到了一个新的问题,给定n个物品的价值,和01背包一样,每个物品只能选1次或0次,求最小不能被得到的价值. 输入 第一行一个正整数T(T <= 100),表 ...
- Linux下route add 命令加入路由列表
route add命令的主要作用是加入静态路由,通常的格式是: route ADD 157.0.0.0 MASK 255.0.0.0 157.55.80.1 METRIC 3 IF 2 參数含义:d ...
- java面向接口编程
在oop中有一种设计原则是面向接口编程,面向接口编程有非常多优点,详细百度一大片.我来谈一下详细的使用中的一些不成熟的见解.! 首先面向接口编程能够消除类之间的依赖关系,使得业务仅仅依赖接口. 这样有 ...