DMOPC '14 Exam Time P1 - French Homework

View as PDF

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

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

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 of up to 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 Input 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.

• commented on Feb. 10, 2015, 3: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?

• commented on Feb. 10, 2015, 3: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.

• commented on Jan. 13, 2015, 3:48 p.m.
• commented on Jan. 13, 2015, 6:20 p.m.
• commented on Jan. 13, 2015, 3:34 p.m.

first sample input has a typo

• commented on Jan. 13, 2015, 3:39 p.m.

One of the sample outputs was wrong: It should have been les concours instead of le concours, although both are grammatically correct. Both sample inputs have been changed.