Problem Statement | |||||||||||||
Tagalog is one of the major languages spoken in the Philippines. Since the USA occupied the Philippines from 1899 to 1946, it has been the custom of Tagalog-speakers to use English words and conjugate them as if they were Tagalog words, creating a language they call "Taglish". You are to write an English-Taglish translator that will convert a simple English sentence into a Taglish sentence by conjugating the verb and adjusting the syntax according to Tagalog grammar rules. The English sentence will come in the format: <subject> <verb> (<object>) The <subject> will be either a single-word name or the word "The" followed by a single-word thing. The <verb> will be a single word, or a word preceded by the word "will". It is in the future tense if it is preceded by the word "will", past tense if the verb ends in the letters "ed", or present tense otherwise. If there is an object, it will be in the format of the subject ("name" or "the thing"), but it also may be preceded by the word "to". Note that "the", "will" or "to", or the suffix "ed" may be in any case or mixed case. If the verb is preceded with the word "will" and ends with "ed", it should be considered future tense. The returned String will be in the format: <re-conjugated verb> <subject> (<object>) The verb conjugation works as follows:
In the present and future tense, the "first syllable" is defined as any consonants at the beginning of the word followed by exactly one vowel (where a vowel is a upper- or lower-case a, e, i, o, or u and a consonant is any other letter). If the <subject> in the English sentence is a thing, omit the word "the" in the Taglish sentance and prepend the Tagalog article, "ang" to the subject to form the Taglish subject. If the <subject> is a name, prepend the Tagalog article "si" to the English name. If there was an object in the English sentence, the <object> in the Taglish sentence is the object from the English sentence preceded by a Tagalog article which depends on the nature of the object:
Case should be preserved in both the words that are carried over and in any doubling of syllables, but new words or letters added to words should be added in lower-case. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | 'y' is never a vowel in Tagalog. | ||||||||||||
- | The only distinction between a name and a thing is the presence of the word "the". | ||||||||||||
- | Remember that the object may be preceded by two words - "to" and "the". If both are present, the "to" will precede the "the" (as in English). | ||||||||||||
- | Do not change the case of letters in any words. When doubling syllables, use the same case as they were in the existing syllable. When adding other letters or words into the translation, use lower-case letters. | ||||||||||||
- | "To", "the" and "will" will always be "control" words if they appear in the place where they could be used as a "control" word. | ||||||||||||
Constraints | |||||||||||||
- | sentence will have a valid subject and verb, and will either end with the verb or have a valid object. | ||||||||||||
- | Each word in sentence will have at least one vowel (a, e, i, o, or u). | ||||||||||||
- | sentence will be between 3 and 50 characters in length, inclusive. | ||||||||||||
- | sentence will have between 2 and 7 words, inclusive, delimited by single spaces. | ||||||||||||
- | sentence will contain only upper- and lower-case letters and spaces. | ||||||||||||
- | sentence will not have any leading or trailing spaces. | ||||||||||||
- | sentence will not have any consecutive spaces (words in sentence will be delimited by single spaces). | ||||||||||||
- | The verb in the sentence will not be "ed". | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
| |||||||||||||
5) | |||||||||||||
|