题解 | #字符个数统计#

字符个数统计

https://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50

// HJ10 字符个数统计.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include<bits/stdc++.h>

using namespace std;

class Solution {
public:
	int Sum_char(string& s)
	{
		sort(s.begin(), s.end());
		s.erase(unique(s.begin(), s.end()), s.end());
		return s.size();
	}
};

int main()
{
	Solution a;
	string s;
	int b;
	while (getline(cin, s))
	{
		b=a.Sum_char(s);
		cout << b << endl;
	}
	return 0;
}

全部评论

相关推荐

04-08 16:35
门头沟学院 Java
点赞 评论 收藏
分享
03-23 15:00
已编辑
厦门大学 Java
xiaowl:你这个简历的问题是对于技术点、项目的描述,都是描述action的,对于面试官而言,仅能知道你干了什么,无法判断你为什么这么干,干的好不好。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务