AIDeveloper @ 2024-03-14 18:01:44
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cmath>
#include <algorithm>
#include<string.h>
#define PI 3.14
using namespace std;
int main(void)
{
string ch;
cin>>ch;
for(int i=0;i<ch.length();i++)
{
if(i==0&&ch.find(ch[0],1)==-1)
{
cout<<ch[0];
return 0;
}
if(ch.find(ch[i],i+1)==-1&&i>0&&ch[i]!=ch[i-1])
{
cout<<ch[i];
return 0;
}
}
cout<<"no"<<endl;
return 0;
}
by liuyuxiang520 @ 2024-03-14 18:10:16
#include<iostream>
using namespace std;
string b ;
int k[30] ;
int main(){
cin >> b ;
for(int i = 0 ; i < b.size() ; i++){
k[b[i] - 'a']++ ;
}
for(int i = 0 ; i < b.size() ; i++){
if(k[b[i] - 'a'] == 1){
cout << b[i] ;
return 0 ;
}
}
cout << "no" ;
return 0 ;
}