Your new graphical programming language Honu contains the primitives 'L' (turn left),
'R' (turn right), 'U' (turn up), 'D' (turn down), and 'F' (move forward), to describe the
actions of a trailleaving turtle in the threedimensional sea.
Only the 'F' command actually moves
the turtle, and it always moves it one unit forward. All other commands simply
change the orientation of the turtle. The turn commands all are with respect to
the turtle's current orientation. That is, 'R' means the turtle turns towards its
current right side; 'U' means the turtle turns towards where its shell is facing.
In addition, commands can be repeated if they are immediately followed by a
single digit from 1 to 9. So "F3" moves forward 3 units. There will not be
adjacent digits in the command string. Digits may only follow the characters
'U', 'D', 'R', 'L', 'F', or ')'. The repeat count only applies to the
immediately previous command, so "FF3" only advances four units.
Commands can also be grouped by parentheses. So "(FRFL)5" traces a zigzag
line, repeating "FRFL" five times.
Parentheses can be nested, so "((F2)2)2" moves forward 8 units.
Given a sequence of these commands, your method must return the
Euclidean distance from where the
turtle began to where it ended up.
