Returning Home | 프로그래밍의 벗 PivotOJ
PivotOJ

Returning Home

시간 제한: 1000ms메모리 제한: 128MB출처: CCC 2005 JuniorBOJ 6873

문제

Jane's family has just moved to a new city and today is her first day of school. She has a list of instructions for walking from her home to the school. Each instruction describes a turn she must make. For example, the list

R
QUEEN
R
FOURTH
R
SCHOOL

means that she must turn right onto Queen Street, then turn right onto Fourth Street, then finally turn right into the school. Your task is to write a computer program which will create instructions for walking in the opposite direction: from her school to her home. The input and output for your program will be formatted like the samples below. You may assume that Jane's list contains at least two but at most five instructions, and you may assume that each line contains at most 10 characters, all of them capital letters. The last instruction will always be a turn into the "SCHOOL".

예제

예제 1

입력
R
QUEEN
R
FOURTH
R
SCHOOL
출력
Turn LEFT onto FOURTH street.
Turn LEFT onto QUEEN street.
Turn LEFT into your HOME.

예제 2

입력
L
MAIN
R
SCHOOL
출력
Turn LEFT onto MAIN street.
Turn RIGHT into your HOME.
코드를 제출하려면 로그인하세요.