-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1437URI.c
More file actions
45 lines (40 loc) · 996 Bytes
/
Copy path1437URI.c
File metadata and controls
45 lines (40 loc) · 996 Bytes
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
40
41
42
43
44
45
#include <stdio.h>
int main(){
int a,i;
char c,p='N';
while(scanf("%d",&a)){
if (a == 0){
break;
}
for (i=0;i<a;i++){
scanf(" %c",&c);
if (p == 'N' && c == 'E' ){
p = 'O';
}
else if ( p == 'N' && c == 'D' ){
p = 'L';
}
else if (p == 'S' && c == 'E' ){
p = 'L';
}
else if (p == 'S' && c == 'D' ){
p = 'O';
}
else if (p == 'L' && c == 'E' ){
p = 'N';
}
else if (p == 'L' && c == 'D' ){
p = 'S';
}
else if (p == 'O' && c == 'E' ){
p = 'S';
}
else if (p == 'O' && c == 'D' ){
p = 'N';
}
}
printf("%c\n",p);
p = 'N';
}
return 0;
}