程式碼
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
string s;
int n;
cin >> s >> n;
int i = 0;
while (i != s.size())
{
if (s[i] - '0' == n)
{
s.erase(i, 1);
}
else
i++;
}
bool flag = true;
for (int i = 0; i < s.size() / 2; i++)
{
if (s[i] != s[s.size() - i - 1])
{
flag = false;
break;
}
}
if (flag) cout << "Yes";
else cout << "No";
return 0;
}
沒有留言:
張貼留言