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


  • -1
    348899568  commented on Nov. 11, 2021, 2:30 p.m.

    Can someone tell me how to do this question.


  • -3
    eggsdie  commented on Nov. 7, 2021, 8:00 p.m.

    this question kinda sucked


    • -4
      EZAF_ANDY  commented on Nov. 7, 2021, 8:00 p.m.

      Like ur mom lol


      • 2
        Haoyun  commented on Nov. 9, 2021, 12:06 p.m.

        That's not nice!


  • -4
    pvchan  commented on Nov. 3, 2021, 4:22 p.m.

    I kept getting WA because of the last test case 'floor', my output was floour, which is technically right because thats more than 4 letters, as specified in the question.

    alas i changed the program to test for more than 5 letters and i got AC

    total bogus ques.......


    • 1
      Dr_R_Evans  commented on Nov. 3, 2021, 5:21 p.m. edited

      Dear pvchan,

      Technically "floour" is not a correct output according to the instructions, due to the fact the 'or' does not follow a consonant; instead, it follows the vowel 'o'. I just ran my code and did not get 'floour'.

      Regards, R.


  • -1
    Summation  commented on April 14, 2021, 12:44 p.m.

    Does anyone have additional test cases for this problem?


    • 1
      Tommy_Shan  commented on July 27, 2021, 7:19 p.m.

      sailor lour parlor for pallor poor bailor quit!


    • 0
      PlayfulDUDE  commented on May 14, 2021, 8:23 p.m.

      no


    • 2
      faraz123  commented on April 14, 2021, 7:04 p.m.

      Your first submission failed to check for consonants before "or"


  • -1
    adam_t27  commented on Oct. 24, 2020, 11:00 p.m. edited

    I keep getting WA and I am confused as my program seems to work perfectly.

    edit: nevermind I forgot to make sure that "or" was at the end of the word


  • -1
    DotonPY  commented on Oct. 23, 2020, 12:00 a.m. edited

    deleted


  • -6
    349081547  commented on Jan. 11, 2020, 10:17 a.m. edited

    This comment is hidden due to too much negative feedback. Click here to view it.


    • -11
      Super_User  commented on Jan. 27, 2020, 9:35 p.m.

      This comment is hidden due to too much negative feedback. Click here to view it.


      • -2
        zxcvbnmasdfghjklqwertyuiop  commented on Oct. 25, 2021, 11:22 p.m.

        why are people downvoting this? they're just helping another person.


      • 16
        jasone  commented on Feb. 5, 2020, 7:25 p.m.

        it says suffix so it's only at the end


        • 0
          TheCallousSword  commented on July 24, 2020, 1:15 p.m.

          Count the syllables using the number of chunks of vowels separated by consonants.


        • -86
          alexshao  commented on Feb. 5, 2020, 10:51 p.m. edited

          This comment is hidden due to too much negative feedback. Click here to view it.


  • 0
    SeanJxie  commented on Oct. 27, 2019, 11:45 p.m.

    Why do I keep getting WA? Everything seems fine to me


  • 0
    Harryg33107  commented on Aug. 28, 2019, 12:32 p.m.

    Can I assume the input is all lowercase letters?


  • -1
    HARRIBO  commented on Aug. 23, 2019, 7:32 p.m.

    Can someone please tell me why I'm on WA?!?!


    • 0
      magicalsoup  commented on Aug. 24, 2019, 12:09 a.m.

      I recommend you join the dmoj slack, it seems that you need alot of help with questions.


    • 0
      injust  commented on Aug. 23, 2019, 10:42 p.m.

      Also because your input reading logic is funky and you are mutating the list as you iterate through it.


    • 1
      Kirito  commented on Aug. 23, 2019, 10:06 p.m.

      Because your program does not implement the last paragraph of the problem statement.


  • -1
    patrickscanlon  commented on June 6, 2019, 8:32 a.m.

    sos


  • 0
    Charles232  commented on Jan. 17, 2019, 9:19 p.m.

    What if the word has 2 "or"s???


    • 3
      magicalsoup  commented on Jan. 17, 2019, 9:34 p.m.

      it wont happen, according to the ccc test cases, but i believe the problem statement is clear enough


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

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


    • 16
      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"


      • 0
        DotonPY  commented on Oct. 23, 2020, 12:01 a.m.

        Why is it 'ourderr' and not 'ourder'?


      • 0
        AmineHamoura03  commented on Feb. 28, 2018, 10:18 a.m.

        Fixed,Thank's.