CodeForces 443A Anton and Letters
来源:互联网 发布:网络诈骗50万100万 编辑:程序博客网 时间:2024/05/22 20:36
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<cstring>#include<cstdio>#include<iostream>using namespace std;int num[25];char s[1100];int main(){ int n,len,sum,i; while(gets(s)){ sum=0; memset(num,0,sizeof(num)); len=strlen(s); for(i=0;i<len;i++){ if(s[i]>='a'&&s[i]<='z'){ num[s[i]-'a']=1; } } for(i=0;i<=25;i++){ if(num[i]==1){ sum++; } } cout<<sum<<endl; } return 0;}
- Codeforces 443A Anton and Letters(水题)
- CodeForces 443A Anton and Letters
- CodeForces 443A Anton and Letters
- 443A - Anton and Letters
- codeforces——443A——Anton and Letters
- Codeforces Anton and Letters
- A. Anton and Letters
- Codeforces Round #253 (Div. 2)A. Anton and Letters
- Codeforces Round #253 (Div. 2) A. Anton and Letters
- CF 253A. Anton and Letters
- A. Anton and Letters Codeforces Round #253 (Div. 2) set 应用
- cf443A Anton and Letters
- Anton and Letters
- Anton and Letters - CF#253 (Div. 2)A (443A) 大水
- 【77.39%】【codeforces 734A】Anton and Danik
- codeforces 734A .Anton and Danik
- 【codeforces 785A】Anton and Polyhedrons
- Codeforces Round#404 A. Anton and Polyhedrons
- AJAX学习笔记(五)——JSON格式
- Spring Integration实例代码分析之basic--http
- mongodb
- SQL Server中的事务与锁
- QT5.5 webengine 打开browser 后调用 web 的 JavaScript
- CodeForces 443A Anton and Letters
- android 常用的 默认开关的 意义
- Android多屏适配
- Android 内存优化
- 给 Android 开发者的 RxJava 详解
- 用UIColloctionView 实现cell放大以及无限轮播
- Codeforces 514A Chewbaсca and Number
- hadoop2.7.1的一些新特性
- Hadoop YARN学习之核心概念(2)