可以逆推一下通过偶数长串来达到回文串和通过奇数长串来达到回文串的前提串,这个前提串必定也一定是回文串了,因此如果初始时不是回文串,则剩下的只需要比较串长即可。
#include<iostream>
#include<queue>
#include<string>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
int a[30];
int main()
{
string s;
cin >> s;
for(int i = 0;s[i];++i){
a[s[i] - 'a']++;
}
int len = s.length();
if(len & 1){
cout << "First" << endl;
}
else{
int c = 0;
for(int i = 0;i < 26;++i){
if((a[i] & 1)){
c++;
}
}
if(c){
cout << "Second" << endl;
}
else{
cout << "First" << endl;
}
}
return 0;
}