#include using namespace std; class Robot { public: Robot(); void move(); void turnLeft(); void turnRight(); int getMeridian() const; int getParallel() const; char getDirection() const; private: short direction; short meridian; short parallel; }; char directions[4] ={ 'N', 'E', 'S', 'W' }; short dx[4] ={ 0, 1, 0, -1 }; short dy[4] ={ -1, 0, 1, 0 }; Robot::Robot() { meridian = 0; parallel = 0; direction = 0; } char Robot::getDirection() const { return directions[direction]; } void Robot::turnLeft() { direction = ( direction + 3 ) % 4; } void Robot::turnRight() { direction = (direction + 1) % 4; } void Robot::move() { parallel += dy[direction]; meridian += dx[direction]; } int Robot::getMeridian() const { return meridian; } int Robot::getParallel() const { return parallel; } int main() { Robot r; char word[10]; int n; cin >> n; for ( int i = 0; i < n; ++i ) { cin >> word; switch (word[0]) { case 'l': r.turnLeft(); break; case 'r': r.turnRight(); break; case 'm': r.move(); break; } } cout << r.getDirection() << ' '<< r.getMeridian() <<' ' << r.getParallel() <