QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#323813 | #5577. Alchemy | thanhha1210 | Compile Error | / | / | C++14 | 572b | 2024-02-10 13:32:31 | 2024-02-10 13:32:32 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
string s;
cin >> s;
int len = s.length();
int cnt = 0;
int i = 0, j = len - 1;
while (i < j) {
if (s[i] == s[j]) {
i++;
j--;
}
else (s[i] != s[j]) {
if (j == i + 1) {
cnt += 1;
j--;
i++;
}
else {
cnt += 2;
j-= 2;
i+= 2;
}
}
}
cout << cnt << endl;
}
Details
answer.code: In function ‘int main()’: answer.code:17:28: error: expected ‘;’ before ‘{’ token 17 | else (s[i] != s[j]) { | ^~ | ;