字符串中第一个仅出现一次的字母
#include<bits/stdc++.h>
using namespace std;
int main(){
int t[256];
string s;
int i;
cin >> s;
for(i = 0 ; i < 256 ; i ++){
t[i] = 0;
}
for(i = 0 ; i < s.length() ; i++){
t[s[i]] ++ ;
}
for(i = 0 ; i < s.length() ; i++){
if(t[s[i]] == 1){
cout << s[i] << endl;
return 0;
}
}
cout << "no";
return 0;
}
一、模拟策略
二、字符处理
三、枚举
判断回文
bool is_plalindrome(string s){
int size = s.size();
for(int i = 0 ; i < size;i++){
if(s[i] != s[size-1 - i]){
return false;
}
}
return true ;
}