⚡ Build the skills to land top-paying quant jobs. Offer ends in 30d 01h 35m 26s30 days 1 hours 35 minutes 26 seconds.
While on vacation in Terniquaternaria, Decimus got to experience the country’s traditional folkloric dance, which they call the “Yawn-ock”. The people of Terniquaternaria pride themselves on being rational, so they dance the Yawn-ock by the following strict rules. Four dancers hold one end of two long pieces of rope and never let go. They initially take the following positions:
A D
\_________/
_________
/ \
B C
During the entire dance, only two types of move are allowed:
Moves are carried out in the order they are written, from left to right.
A fact you may use without proof (John Conway's theory of rational tangles). Every tangle these dancers can make has a label x, which is a rational number or the symbol ∞. Two tangles are the same, up to sliding the rope around with the ends held fixed, exactly when they have the same label. The labels behave as follows:
From the initial configuration, a dance master calls out successive R/S steps randomly, that the dancers diligently execute accompanied by music. After this, there is usually quite a tangled mess of rope in the middle!
A participant from the crowd can then step forward and attempt to untangle the ropes by shouting a sequence of the same two moves as above, that the dancers execute. If this person succeeds in fully untangling the ropes (bringing the label back to exactly 0), he/she gets crowned King/Queen for the day!
Decimus took careful note of the sequence of moves executed by the dancers. It is one continuous dance of 105 moves, printed over three lines; read it left to right, line after line:
SRSRRSSRSRSSRSSRRSSRSSSSSRSSRSSRSRS
SRSSRSSSSSSSSRSSRSSSSSRSSRSSRRSSRSS
SSSRSSRSSRSSSSSSSSSSSSSSSSSRSSRSSRSHe would really like to become King, no matter how much research it might take. The dancers have limited endurance, so he wants the untangling sequence to be as short as possible.
Question. Starting from the tangle left by this dance, what is the shortest sequence of R/S moves that untangles the ropes, meaning it brings the label back to exactly 0?
Answer format: there is exactly one shortest untangling sequence. Give two integers separated by a comma: its length L, and the sum of the positions (numbered 1 to L from the left) at which the letter R occurs in it. For example, the sequence RSSRS would be reported as 5, 5, since its R's are at positions 1 and 4.