70分
查看原帖
70分
548059
VastUniverse_Hory楼主2022/9/20 13:19
#include <bits/stdc++.h>
using namespace std;

int main()
{
	ios :: sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    unordered_map <int, int> t;
    string a;
    set <int> o;
    getline(cin, a);
    for (char & i: a)
    {
		t[i] ++;
	}
	for (int i = 0; i <= 1000; i ++)
		if (t[i] == 1)
			o.insert(i);
	bool has = false;
	for (int i = 0; i < a.size(); i ++)
		if (o.count(a[i]))
		{
			cout << a[i] << endl;
			has = true;
			break;
		}
	if (! has)
		cout << "no" << endl;
    return 0;
}

C++

2022/9/20 13:19
加载中...