#C7921. Maximum Euclidean Distance of Robot Path
Maximum Euclidean Distance of Robot Path
Maximum Euclidean Distance of Robot Path
A robot is placed at the origin \((0,0)\) of a Cartesian plane. It receives a sequence of moves represented by a string consisting of the characters \(U\) (up), \(D\) (down), \(L\) (left), and \(R\) (right). The robot executes each move in sequence. Your task is to compute the maximum Euclidean distance from the origin that the robot reaches during the journey. The Euclidean distance between points \((x,y)\) and the origin \((0,0)\) is given by \(\sqrt{x^2+y^2}\). The output must be rounded to 6 decimal places.
Example:
Input: UUDDLLRR Output: 2.000000
inputFormat
The input consists of a single line containing a non-empty string which represents the sequence of moves. Each character in the string is one of the following: 'U', 'D', 'L', or 'R'.
outputFormat
Output the maximum Euclidean distance from the origin reached during the moves sequence, rounded to 6 decimal places. The output should be printed to standard output.
## sampleUUDDLLRR
2.000000