A. Anton and Letters
2 seconds
256 megabytes
standard input
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.
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.
Print a single number — the number of distinct letters in Anton's set.
{a, b, c}
3
{b, a, b, a}
2
{}
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的更多相关文章
- 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 ...
- Y - Anton and Letters
Problem description Recently, Anton has found a set. The set consists of small English letters. Anto ...
- 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 ...
- 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 ...
- C - Anton and Danik
Problem description Anton likes to play chess, and so does his friend Danik. Once they have played n ...
- 【77.39%】【codeforces 734A】Anton and Danik
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- [LeetCode] Remove Duplicate Letters 移除重复字母
Given a string which contains only lowercase letters, remove duplicate letters so that every letter ...
随机推荐
- tangible T4 Editor 2.2.3 for VS2010 / VS2012 / VS2013 Preview
tangible T4 Editor 2.2.3 for VS2010 / VS2012 / VS2013 Preview angible T4 Editor 2.2.3 plus UML model ...
- linux多线程socket编程一些心得
http://hi.baidu.com/netpet/blog/item/2cc79216d9012b54f2de32b9.html 前段时间将新的web模型办到linux上来,用epoll代替了IO ...
- 如何将ASM中的数据文件复制到操作系统中
环境:Red Hat 5.7 + Oracle 10.2.0.5.0 Rac+ASM 如果你的Oracle数据库系统使用正使用ASM自动存储管理,你可曾想过要窥视一下ASM中的数据文件,ASM是个黑匣 ...
- 分享几种Linux软件的安装方法
Linux软件安装由于不同的Linux分支,安装方法也互不相同,介绍几种常见的安装方法. 1. 源码安装, 对于本身具有开源血统的Linux系统来说,几乎所有的开源软件都支持在Linux平台运 ...
- WIN7 64位系统安装JDK并配置环境变量
本文来自:http://jingyan.baidu.com/article/3c343ff70bc6ea0d377963df.html 工具/原料 JDK 方法/步骤 首先,下载JDK安装包,到官 ...
- Akka边学边写(2)-- Echo Server
EchoServer 上篇文章里,我们用Akka写了一个简单的HelloWorld样例,对Akka(以及Actor模式)有了初步的认识.本文将用Akka写一个EchoServer,看看在Actor的世 ...
- react-native 环境配置及hello world
一.前言 最近手头的工作繁多,有研究性的项目和系统研发,正好遇到同事离职,接手了框架的UI组件,不仅需要维护和填坑,还需要开发新的功能组件.因为身在H5-Hybird的框架部门,最近团队开始尝试使用R ...
- C# 调用存储过程传入表变量作为参数
首先在SQLServer定义一个自定义表类型: USE [ABC] GO CREATE TYPE [ABC].[MyCustomType] AS TABLE( ) NOT NULL, ) NULL, ...
- CSS-边框-效果
1.1边框 其中边框圆角.边框阴影属性,应用十分广泛,兼容性也相对较好,具有符合渐进增强原则的特性,我们需要重点掌握. 1.1.1边框圆角 border-radius 每个角可以设置两个值,x值,y值 ...
- session之退出登陆
<span style="font-size:32px;">//使用SESSION必须先开启session session_start(); //彻底删除session ...