#C1386. Determine the Final Lock State

    ID: 43444 Type: Default 1000ms 256MiB

Determine the Final Lock State

Determine the Final Lock State

You are given a string of commands consisting of the characters U and L. The command U stands for an unlock operation and L for a lock operation. Initially, the lock is in the Locked state.

Your task is to process the string of commands in order. While processing, maintain a sliding window (sequence) of the last six commands. If at any point the sequence of commands exactly matches the pattern \(UUULLL\) in that order, the lock is immediately reset to the Locked state and the sequence is cleared. Otherwise, if the command is U then the state is changed to Unlocked, and if the command is L then the state is changed to Locked regardless of the previous state.

After processing all commands, output the final state of the lock. If no commands are given, the lock remains Locked.

inputFormat

The input consists of a single line containing a string of characters. The string only includes the characters U and L. The input should be read from the standard input (stdin).

outputFormat

Output a single line containing the final state of the lock: either Locked or Unlocked. The output should be written to the standard output (stdout).

## sample
UUULLLUUULLLL
Locked