Blame view

P79784_en/S001-AC.cc 353 Bytes
Imanol-Mikel Barba Sabariego authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream>

using namespace std;

int main()
{
	char c;
	int x=0,y=0;

	do
	{
		cin >> c;
		if(cin.eof())
		{
			break;
		}
		switch(c)
		{
			case 'n':
			y--;
			break;

			case 's':
			y++;
			break;

			case 'w':
			x--;
			break;

			case 'e':
			x++;
			break;
		}
	}while(1);
	cout << "(" << x << ", " << y << ")" << endl;
	return 0;

}