AcWing 3609. 回文字符串
原题链接
简单
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int N = 1e6 + 10;
int t, n, m, k, l, r, op, x, y;
int f[N];
bool flag;
//int dp[N][N];
void solve() {
string str;
while (cin >> str) {
int siz = str.size();
l = 0, r = siz - 1;
flag = true;
while (l < r) {
if (str[l++] != str[r--]) {
flag = false;
break;
}
}
if (flag) {
cout << "Yes!";
} else {
cout << "No!";
}
cout << "\n";
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}