Run ID:61937
提交时间:2023-12-16 14:34:10
#include <bits/stdc++.h>. using namespace std; int main () { string s; cin >> s; int len = s.size(); int m[len] = {}; int m1=0; int a[123]= {}; for(int i = 0; i < len ; i++) { a[(int)s[i]]++; } int n = 0; for(int i = 96 ; i < 123 ; i++) { if(a[i]==1) { n++; } } if(n==1) { for(int i = 96 ; i < 123 ; i++) { if(a[i]==1) { cout << (char)i; return 0; } } } if(n > 1) { for(int i = 96 ; i < 123 ; i++) { if(a[i]==1) { m[m1]=char(i); m1++; } } cout << (char)m[0]; return 0; } if(n==0) { cout << "no"; } }