沐里纷纷


私信TA

用户名:Epoch

访问量:62671

签 名:

我不会算法

等  级
排  名 37
经  验 12799
参赛次数 1
文章发表 172
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

不会算法

解题思路:

自动挡

注意事项:

参考代码:

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <set>
#include <string>
#include <vector>
#include <stdio.h>
#include <sstream>
#include <algorithm>

using namespace std;

void splitStr(string origStr, char delim, vector<string>& strArr)
{
	stringstream ss(origStr);
	string temp;
	while (getline(ss, temp, delim))
		strArr.push_back(temp);
}

int solve(string origStr, set<string>& strList)
{
	stringstream ss(origStr);
	string temp;
	while (ss >> temp)
		strList.insert(temp);
	return strList.size();
}

int main()
{
	string str;
	getline(cin, str);
	set<string>* strList = new set<string>;
	cout << solve(str, *strList) << endl;
	delete strList;
	return 0;
}


 

0.0分

0 人评分

  评论区