Problem #9

Code Wars II
Danger Level: Blue Cruiser



}Reversi~

Point Value: 6

Problem Statement

Because the U.S. has imposed export restrictions on encryption software, some smaller nations have no choice but to use simplistic encoding for secret government communications.  Write a decoder for reverse coded messages.

Program Input

The input file PROB09.IN will contain a series of words, and occasionally the key word REVERSI.  Example:

jumped
REVERSI
over
the
REVERSI
fox
brown
quick
REVERSI
lazy
dog
REVERSI
the
REVERSI

Program Output

Store the words in order as they appear in the input file and write them to the screen.  Each time the word REVERSI appears, reverse the order of the words, then add new words to the end of the new list.  Here's the result from the above input file:

the quick brown fox jumped over the lazy dog