博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Anton and Letters
阅读量:6970 次
发布时间:2019-06-27

本文共 1330 字,大约阅读时间需要 4 分钟。

Anton and Letters

time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
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.

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.

Sample test(s)
Input
{a, b, c}
Output
3
Input
{b, a, b, a}
Output
2
Input
{}
Output
0

题意:推断集合里元素的个数。即不算反复的。

AC代码:

import java.util.*;public class Main {	public static void main(String[] args) {		Scanner scan=new Scanner(System.in);		String s=scan.nextLine();		char a[]=new char[s.length()];		a=s.toCharArray();		int b[]=new int[100];		for(int i=0;i


转载地址:http://yjasl.baihongyu.com/

你可能感兴趣的文章
FAST_START_MTTR_TARGE 参数学习
查看>>
【Servlet】01-Web应用体系结构
查看>>
替换Rest?不,软件工程应该构建成熟的REST生态
查看>>
重构到更深层的模型
查看>>
Cordova是否适用于你的目标行业?
查看>>
微软正在考虑将Windows默认浏览器改为Chromium
查看>>
同事反馈环:如何实现持续改进的文化
查看>>
网易云基于Prometheus的微服务监控实践
查看>>
ubuntu 安装nodejs
查看>>
伯克利开源工具库RLib现已支持大规模多智能体强化学习
查看>>
Visual Studio 2019正式版发布,专注于人工智能和生产力
查看>>
多重影分身:一套代码如何生成多个小程序?
查看>>
基于干净语言和好奇心的敏捷指导
查看>>
V8引擎内存消耗的分析和优化
查看>>
Scrum联盟发布2015年Scrum状况报告
查看>>
为什么说我们需要软件架构图?
查看>>
2019年软件测试现状调查
查看>>
关于AWS的Firecracker,技术人应该知道的十件事
查看>>
jQuery 3.3.1已经发布,开发团队正在准备4.0版本
查看>>
微服务架构的设计模式
查看>>