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 ;
}
最新文章
- 使用PowerShell来修改文件访问,创建,修改时间属性
- 剑指offer:大恒图像
- Spring 4 官方文档学习(十一)Web MVC 框架之异常处理
- 补丁vs错误(codevs 2218 错误答案)
- SCCM 部署操作系统 ,提示权限问题,报错:0xc00000098
- 菜鸟学习笔记3——jQuery 选择器
- Fragment监听返回键
- C++ 类的静态成员详细讲解[转]
- IE8浏览器跨域接口访问异常的解决办法
- hdu 1698 线段树成段更新
- Xcode-5.1.1更改文件盯作者
- Unity编程标准导引-Unity中的基本概念-2.1界面概览
- 51 NOD 1238 最小公倍数之和 V3
- SpringMVC之GET请求参数中文乱码
- ADFS部署过程中设置network service对证书的读取权限
- linux 下查看wwn号
- Entity Framework入门教程(2)---EF工作流程
- Nginx代理与负载均衡
- GoStudy——解决vscode中golang插件依赖安装失败问题
- 《Linux内核设计与分析》第四章读书笔记
热门文章
- 阿里P8架构师详解Java性能调优策略
- 将数据库中的内容展示出来并将某些value值转换成汉字
- Huawei-R&;S-网络工程师实验笔记20190524-VRP的系统、接口视图下基本操作
- TypeError: CleanWebpackPlugin is not a constructor
- 清北学堂模拟赛d3t5 c
- 神奇的幻方 noip2015day1 T1
- 学习KNN算法体会和总结
- [PWA] Check Online Status by using the NavigatorOnLine API
- java面向接口编程
- UVALive - 6910 (离线逆序并查集)