maodan11hao @ 2024-08-22 12:49:49
#include<bits/stdc++.h>
using namespace std;
struct s{
char name;
int cx;
};
s x[1101];
int p;
bool b=true;
string s;
int main(){
cin>>s;
for(int i=0;i<s.size();i++){
for(int j=0;j<p;j++){
if(x[j].name==s[i]){
b=false;
x[j].cx++;
}
}
if(b){
x[p].name=s[i];
x[p].cx++;
p++;
}
}
for(int i=0;i<p;i++){
if(x[i].cx==1){
cout<<x[i].name;
return 0;
}
}
cout<<"no";
return 0;
}
by haimingbei @ 2024-08-22 12:55:42
@maodan11hao ~~ 球馆
#include<bits/stdc++.h>
using namespace std;
int main(){
char str[1101];
cin.get(str,1101);
int len=strlen(str);
for(int i=0;i<len;i++){
int s=0;
for(int j=0;j<len;j++){
if(str[i]==str[j])s++;
}
if(s==1){
cout<<str[i];
return 0;
}
}
cout<<"no";
return 0;
}
by I_LOVE_XYN @ 2024-08-22 13:36:32
@maodan11hao b每一次for都要变成1
by I_LOVE_XYN @ 2024-08-22 13:37:23
@maodan11hao 改了就可以直接过了
by maodan11hao @ 2024-08-22 14:01:13
@I_LOVE_XYN ok