keda2761 @ 2023-01-13 14:29:07
#include<bits/stdc++.h>
using namespace std;
char ch[5005];
int n[5005];
int main(){
cin>>ch;
for(int i=0;ch[i]!='\0';i++){
n[ch[i]-97]++;
}
for(int i=0;i<26;i++){
if(n[i]==1){
cout<<char(i+97);
return 0;
}
}
cout<<"no";
return 0;
}
by GSRgsrgsr @ 2023-01-13 14:32:03
@zhouyilin 第一个指在序列中的位置,所以应该将序列再扫一遍
by GSRgsrgsr @ 2023-01-13 14:34:48
hack:
inout:cba
output:c
your ouput:a
by keda2761 @ 2023-01-13 14:35:24
那代码呢?@GSRgsrgsr
by GSRgsrgsr @ 2023-01-13 14:37:29
等下我写
by GSRgsrgsr @ 2023-01-13 14:40:11
#include<bits/stdc++.h>
#define int long long
using namespace std;
map<char,int> mp;
signed main(){
string s;
cin>>s;
int l=s.length();
for(int i=0;i<l;++i)mp[s[i]]++;
for(int i=0;i<l;++i){
if(mp[s[i]]==1){
printf("%c",s[i]);
return 0;
}
}
printf("no");
return 0;
}
by keda2761 @ 2023-01-13 14:42:33
谢啦!@GSRgsrgsr
by keda2761 @ 2023-01-15 13:33:31
AC代码吗?@GSRgsrgsr
by GSRgsrgsr @ 2023-01-15 14:06:10
@zhouyilin 是的,我交了一发A了
by GSRgsrgsr @ 2023-01-15 14:06:41
@zhouyilin AC记录
by keda2761 @ 2023-01-16 09:20:55
@GSRgsrgsr AC了。