根据状态进行判断

#include<iostream>
#include<map>
using namespace std;

int main(){
    map<char,char> e;
    e['R'] = 'S';
    e['L'] = 'N';
    map<char,char> s;
    s['R'] = 'W';
    s['L'] = 'E';
    map<char,char> w;
    w['L'] = 'S';
    w['R'] = 'N';
    map<char,char> n;
    n['L'] = 'W';
    n['R'] = 'E';
    
    int num = 0;
    cin>>num;
    string str;
    cin>>str;
    char status = 'N';
    for(int i = 0;i<num;i++){
        switch(status){
            case 'N':
                status = n[str[i]];
                break;
            case 'E':
                status = e[str[i]];
                break;
            case 'W':
                status = w[str[i]];
                break;
            case 'S':
                status = s[str[i]];
                break;
        }
    }
    cout<<status;
    
    
}