Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
61937 周语涵 只出现一次的字符 C++ Wrong Answer 1 MS 284 KB 610 2023-12-16 14:34:10

Tests(1/10):


Code:

#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"; } }


Run Info:

------Input------
phqghumeay
------Answer-----
p
------Your output-----
a