DMOPC '14 Exam Time P1 - French Homework

View as PDF

Submit solution


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

Author:
Problem type

One day you are too busy figuring out a programming contest question to realize that you have French homework due the next day!

Surprisingly, your French teacher decides to mark the sheets and sees you rapidly scribbling as she passes by. Since she knows that you are very talented at programming, she decides to give you another chance — with a catch.

The second chance is that you may finish completing the worksheet in class, however; you must directly copy all the answers from a program you wrote under her direct supervision.

In French, the order of sentences generally follows a Subject-Verb-Object structure. For questions, this can change to a Verb-Subject-Object order. We will assume that the subject will always be tu and note that the verb will already be conjugated in the present tense for the second person singular.

In addition, you notice the following pattern (which is true most of the time):

If the word ends with e, then it is feminine (la)
If the word ends with s, then it is plural (les)
Otherwise, we can assume the word to be masculine (le)

You also notice on the sheet that none of the words on the second line of each case begin with a vowel.

Input Specification

The first line of input will consist of the verb while the second line of input will consist of the object. Each word will be up to 30 characters in length.

Output Specification

Output the words as a question formed using inversion.

Sample Input 1

Fais
devoirs

Sample Output 1

Fais-tu les devoirs ?

Sample Input 2

Aimes
ordinateurs

Sample Output 2

Aimes-tu les ordinateurs ?

Explanation for Sample Output 2

Since devoirs and ordinateurs both end with an s, we may assume that they require les. Note that this is not always true (for example, "le vers" means "the verse"), but the test data will not contain such cases.


Comments


  • 6
    HusseinK  commented on March 12, 2021, 5:53 p.m.

    The moment you realize that you need a question mark at the end of the sentence with a space.


  • 1
    andrew498  commented on Feb. 10, 2015, 8:17 p.m.

    "If the word ends with e, then it is feminine (la) If the word ends with s, then it is plural (les) Otherwise, we can assume the word to be masculine (le)"

    Which word are you talking about? The verb or the object or both?


    • 3
      Sentient  commented on Feb. 10, 2015, 8:40 p.m.

      The word refers the object. For example, in the first sample input, the object would be devoirs, which requires les. If it were devoir, it would have required le, and if it were feminine, it would have required la.