Var s: string; a, b: integer; begin readln(s); if s[1] = 'x' then begin a := StrToInt(s[3]); b := StrToInt(s[5]); if s[2] = '-' then a := -a; writeln(b - a); end else if s[3] = 'x' then begin a := StrToInt(s[1]); b := StrToInt(s[5]); if s[2] = '-' then begin a := -a; b := -b; end; writeln(b - a); end else if s[5] = 'x' then begin a := StrToInt(s[1]); b := StrToInt(s[3]); if s[2] = '-' then b := -b; writeln(a + b); end end.
учтите что никакой защиты от дурака или неверного ввода
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
signed main() {
string line, buff = "";
bool isPalindrome = true;
getline(cin, line);
for (int i = 0; i < line.size(); i++) {
if (isalnum(line[i]))
buff += line[i];
}
for (int i = 0; i < buff.size() / 2; ++i)
{
if (buff[i] != buff[buff.size() - i - 1])
{
isPalindrome = false;
break;
}
}
if (isPalindrome)
cout << "TRUE";
else
cout << "FALSE";
return 0;
}