Submission
Status:
----x-x---
Score: 0
User: foldnut
Problemset: นักเดินทาง
Language: c
Time: 0.001 second
Submitted On: 2024-09-26 17:06:11
#include<stdio.h>
#include<math.h>
#include<string.h>
void main(){
char moveset[52];
char a[52] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
scanf("%s",moveset);
/*Length & Height*/
int lenght = 0;
int height = 0;
for(int i = 0;i<52;i++){
if(moveset[i] == 'R'){
height++;
}
else if(moveset[i] == 'D'){
lenght++;
}
}
char chart[lenght][height];
///////////////////////////////////
for(int i = 0;i<height;i++){
for(int j = 0;j<=lenght;j++){
chart[i][j]='.';
}
}
int x = 0;
int y = 0;
chart[0][0] = a[0];
for(int i = 1;i<52;i++){
if(moveset[i] == 'D'){
y++;
}
else if(moveset[i] == 'U'){
y--;
}
else if(moveset[i] == 'L'){
x--;
}
else if(moveset[i] == 'R'){
x++;
}
else{
break;
}
chart[x][y] = a[i];
}
for(int i = 0;i<lenght;i++){
for(int j = 0;j<=height;j++){
printf("%c",chart[j][i]);
}
printf("\n\n");
}
}