- P41's solution
-
题解P41
- @ 2025-11-9 12:02:58
按题意直接模拟即可。
AC code:
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
string s;
cin >> s;
int left = 0, right = s.size() - 1;
while (left < right) {
while (left < right && s[left] == ',') {
left++;
}
while (left < right && s[right] == ',') {
right--;
}
if (left < right && s[left] != s[right]) {
cout << "No" << endl;
return 0;
}
left++;
right--;
}
cout << "Yes" << endl;
return 0;
}