Company: Quince_sde
Difficulty: medium
Carrobot Rectangle Path A robot called Carrobot stands on a coordinate plane and follows a string of moves. Each character is one step of the same length in a cardinal direction: ^ — one step north > — one step east v — one step south < — one step west Every step draws a straight segment from where the robot was to where it lands. After the whole string has been followed, decide whether the drawing is a rectangle : a closed shape with exactly four straight sides, consecutive sides meeting at right angles, and no part of the path crossing or retracing itself. Report true when the drawing is a rectangle, and false otherwise. The robot may begin anywhere along the outline, including in the middle of a side, so a rectangle is not required to start at a corner. Input Format A single line containing the move string, for example ^>v< . (inferred — the source describes a function argument and gives no stdin format, so the string is supplied as the only token on standard input.) Out