Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
493 B
0
Indexable
Never
#include <iostream>
#include <string>
using namespace std;

int main()
{
	string a;
	char b;
	int c, d;
	cin >> a;
	b = a[1];
	if (a[0] == 'x') {
		d = a[2] - '0';
		c = a[4] - '0';
		if (b == '-') cout << c + d;
		else cout << c - d;
	}
	else if (a[2] == 'x') {
		d = a[0] - '0';
		c = a[4] - '0';
		if (b == '-') cout << d - c;
		else cout << c - d;
	}
	else {
		d = a[0] - '0';
		c = a[2] - '0';
		if (b == '-') cout << d - c;
		else cout << d + c;
	
	}
	
}