Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
69217 祝家懿 只出现一次的字符 C++ Runtime Error 0 MS 280 KB 397 2024-03-31 10:47:10

Tests(0/10):


Code:

#include<bits/stdc++.h> using namespace std; int main() { string a; cin>>a; int n=a.size(); int s[26],w[26]; for(int i=0;i<n;i++){ if(a[i]-65){ s[a[i]-65]+=1; } } int f=0; for(int i=0;i<26;i++){ if(s[i]==1){ w[f]=s[i]; f++; } } for(int i=0;i<n;i++){ for(int u=0;u<26;u++) if(w[u]+65==a[i]){ cout<<a[i]; break; } } return 0; }


Run Info:

*** stack smashing detected ***: ./Main terminated