CCC '02 J2 - AmeriCanadian

View as PDF

Submit solution


Points: 3
Time limit: 2.0s
Memory limit: 64M

Problem type

Canadian Computing Competition: 2002 Stage 1, Junior #2

Americans spell differently from Canadians. Americans write neighbor and color while Canadians write neighbour and colour. Write a program to help Americans translate to Canadian.

Your program should interact with the user in the following way. The user should type a word (not to exceed 64 letters) and if the word appears to use American spelling, the program should echo the Canadian spelling for the same word. If the word does not appear to use American spelling, it should be output without change. When the user types quit! the program should terminate.

The rules for detecting American spelling are quite naive: If the word has more than four letters and has a suffix consisting of a consonant followed by or, you may assume it is an American spelling, and that the equivalent Canadian spelling replaces the or by our. Note : you should treat the letter y as a vowel.

Sample Input

color
for
taylor
quit!

Sample Output

colour
for
taylour

Comments


  • 0
    AmineHamoura03  commented on Feb. 26, 2018, 11:48 a.m.

    Can someone tell my please why it's WA ?!


    • 4
      Iamhussam  commented on Feb. 27, 2018, 5:59 p.m.

      your code searches for "or" anywhere in the word, while it should search for it only in the end. e.g : for input "order" your program outputs : "ourderr"