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 ...
随机推荐
- sort,uniq命令
文本排序:sort 默认以ASCII表排序 -n:数值排序 -r: 降序 -t: 字段分隔符 -k: 以哪个字段为关键字进行排序 -u: 排序后相同的行只显示一次 ...
- 【MSP是什么】MSP认证之项目管理与项目群管理的区别
通常所说的项目管理是指运用各种相关知识.技能.方法与工具,为满足或超越项目有关各方对项目的要求与期望,所开展的各种计划.组织.领导.控制等方面的活动.具体包括项目范围管理.项目时间管理.项目成本管理. ...
- Unity 代码规范(PlateFace)1.0版本
PlateFace Unity开发规范(1.0) 1.项目都采用英文名命名,图片,音频,资源都不能采用中文. 2.方法名: 帕斯卡命名(所有单词首字母大写) 3.字段: 在Unity中组件字段名第一个 ...
- Timer和TimerTask
目录结构: Timer和TimerTask 一个Timer调度的例子 如何终止Timer线程 关于cancle方式终止线程 反复执行一个任务 schedule VS. scheduleAtFixedR ...
- Phoenix中Sequence的用法
Phoenix--HBase的JDBC驱动 序列(Sequence)是Phoenix提供的允许产生单调递增数字的一个SQL特性,序列会自动生成顺序递增的序列号,以实现自动提供唯一的主键值. 使用C ...
- [AC自动机][HDU3065]
//====================== // HDU 2222 // 求目标串中出现了几个模式串 //输入 //1 //5 //she //he //say //shr //her //ya ...
- JAX-RS开发 hello world
1.建立maven webapp工程aty-rest. 2. 在pom文件增加spring框架.jax-rs接口.CXF实现 <dependency> <groupId>jav ...
- C#关于ref的用法(多个实参值的传递)
按照C#默认的按值调用参数的传递机制,不能刻编写出一个方法来实现两个int类型的值交换,因为一个方法只能对应一个返回值,如何实现将两个交换的值传递回去,这里我将用到的是ref修饰符. 使用ref的单值 ...
- 查询sybase DB中占用空间最多的前20张表
按照数据行数查询 name, row_count(db_id(), id) from sysobjects order by row_count(db_id(),id) desc 按照分配的空间查询 ...
- Haproxy+PXC实现负载均衡
软件负载均衡一般通过两种方式来实现:基于操作系统的软负载实现和基于第 三方应用的软负载实现.LVS就是基于Linux操作系统实现的一种软负载,HAProxy就是开源的并且基于第三应用实现的软负载.HA ...