좌표 방문 여부 x -> 간선 방문 여부
//fromX, fromY, toX, toY
int board[11][11][11][11];
using namespace std;
int visited[12][12];
int solution(string dirs) {
int answer = 0;
int nx=5;
int ny=5;
for(auto c : dirs){
if(c=='U'){
nx=nx-1;
if(nx<0) {
nx+=1;
continue;
}
}
else if(c=='L'){
ny=ny-1;
if(ny<0) {
ny+=1;
continue;
}
}
else if(c=='D'){
nx=nx+1;
if(nx>10)
{
nx-=1;
continue;
}
}
else{
ny=ny+1;
if(ny>10)
{
ny-=1;
continue;
}
}
if(!visited[nx][ny]){
visited[nx][ny]=1;
answer++;
}
}
return answer;
}