#K90962. Container Final State
Container Final State
Container Final State
In this problem, you are given a container that initially is in a locked state. The container can receive two types of operations: lock
and unlock
. The operations are applied sequentially, and they change the state of the container as follows:
- If the operation is
lock
, the container becomes locked. - If the operation is
unlock
, the container becomes unlocked.
Your task is to determine the final state of the container after applying a sequence of operations. Furthermore, the input consists of multiple datasets, each representing a set of operations. The input terminates with a line containing end
, which should not be processed.
The final state for each dataset must be printed on a separate line.
inputFormat
The input is provided through standard input (stdin) and consists of several lines. Each line (dataset) contains a sequence of operations (lock
or unlock
) separated by space.
The sequence of datasets ends with a line that contains the word end
. Do not process this line.
outputFormat
For each dataset, output the final state of the container (locked
or unlocked
) on a separate line to standard output (stdout).
unlock unlock lock lock
lock unlock
unlock
lock lock unlock
end
locked
unlocked
unlocked
unlocked
</p>