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.
учтите что никакой защиты от дурака или неверного ввода
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.
учтите что никакой защиты от дурака или неверного ввода