2005 Canadian Computing Competition, Stage 1
Problem J3: Returning Home
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".
Sample Input 1
R QUEEN R FOURTH R SCHOOL
Sample Output 1
Turn LEFT onto FOURTH street. Turn LEFT onto QUEEN street. Turn LEFT into your HOME.
Sample Input 2
L MAIN R SCHOOL
Sample Output 2
Turn LEFT onto MAIN street. Turn RIGHT into your HOME.
All Submissions
Best Solutions
Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Sep 29, 2008
Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3
Comments (Search)
He used def and if...
'Cause def is define, which is a function, if I'm not mistaken.
because it says...
R
QUEEN
R
FOURTH
R
SCHOOL
and the output is:
Turn LEFT onto FOURTH street.
Turn LEFT onto QUEEN street.
Turn LEFT into your HOME.
I thought R was RIGHT, not LEFT.
i didnt read the question