cf443A 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
模拟没什么可说的
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
bool mark[27];
int ans;
int main()
{
char ch;
while (1)
{
while ((ch!='}')&&(ch<'a'||ch>'z')) scanf("%c",&ch);
if (ch=='}') break;
if (!mark[ch-'a'])
{
mark[ch-'a']=1;
ans++;
}
ch=' ';
}
printf("%d",ans);
}
cf443A Anton and Letters的更多相关文章
- 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 ...
- 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 ...
随机推荐
- Kafka小记
kafka简介 kafka是由LinkedIn开发,主要是用来处理Linkedin的大面积活跃数据流处理(activity stream). 此类的数据经常用来反映网站的一些有用的信息,比如PV,页 ...
- Mitsubish FX 3U PLC 串口 连接单元
前段时间遇到一个Mitsubish FX 3U PLC ,现将PLC连接单元分享一下,希望对其他人有所启示. unit PLC_MitsubishiFX; interface uses Windows ...
- mfc socket编程
socket编程用法---- 随着计算机网络化的深入,计算机网络编程在程序设计的过程中变得日益重要.由于C++语言对底层操作的优越性,许多文章都曾经介绍过用VC++进行Socket编程的方法.但由于都 ...
- 浅谈Java内存及GC
目录: 1.JAVA虚拟机规范与JAVA虚拟机 2.JVM结构图 3.GC策略与原理 4.垃圾收集算法 5.回收的时机 6.垃圾搜集器 一.JAVA虚拟机规范与JAVA虚拟机 内存,是指程序运行时的数 ...
- $_SERVER变量 以及 PHP 使用 $_SERVER['PHP_SELF'] 获取当前页面地址及其安全性问题
PHP $_SERVER['PHP_SELF'] $_SERVER['PHP_SELF'] 表示当前 php 文件相对于网站根目录的位置地址,与 document root 相关. 假设我们有如下网址 ...
- Java基础知识强化54:经典排序之插入排序(InsertSort)
1. 插入排序原理图: 算法步骤: 1)将第一待排序序列第一个元素看做一个有序序列,把第二个元素到最后一个元素当成是未排序序列. 2)从头到尾依次扫描未排序序列,将扫描到的每个元素插入有序序列的适当位 ...
- (转)ASP.NET 伪静态
1.伪静态:http://www.cnblogs.com/Default.html 目的就是为了赢得更多的收入,至于真否,待SEOer 解答,正如文字所说,伪静态就是假的静态. 2.准备工作:下载Ur ...
- JS将图片文件转为64位字符串再post到接口上传图片
HTML: <div class="ai-item upload-id-img"> <p>上传身份证照片</p> <div class=& ...
- ul li span addClass removeClass
<link type="text/css" href="./style/css/base.css" rel="stylesheet"& ...
- ajax初学
//参数说明url:请求文件地址//fnSucc:请求成功执行的函数,请求成功的条件为readyState状态码为4:且status状态码为200,status状态为浏览器请求返回的状态码//在fnS ...