| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 61942 | 周语涵 | 只出现一次的字符 | C++ | Accepted | 4 MS | 492 KB | 565 | 2023-12-16 14:37:26 |
#include <bits/stdc++.h>. using namespace std; int main () { string s; cin >> s; int len = s.size(); 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 = 0 ; i < len ; i++) { if(a[s[i]]==1) { cout << s[i]; return 0; } } return 0; } if(n==0) { cout << "no"; } }