You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
706 B

5 years ago
## robottoorigin
### Instructions
There is a robot at position (0, 0) at 2D map.
Write a program, that outputs `true` if robot ends up at the origin (0, 0) after a sequence of moves, otherwise `false`. `\n` should be in the end of line.
Sequence of moves is a string, which characters state for movement direction:
- U - up
5 years ago
- D - down
- R - right
- L - left
If the number of arguments is not 1, output nothing.
5 years ago
### Usage
```console
$ go run . "UD"
5 years ago
true
$ go run . "LL"
5 years ago
false
```
In first case, the robot moves up and the down. So, it returned back to its origin position.
In second example, the robot moves twice to the left. It is 2 positions left from its origin, so the program outputs false.