GAELSPEL - Gaelic Spell Checker

 

Your TARDIS has taken you back in time to the castle of James IV, the King of Scots himself.  "Failte gu Alba! Bha mi a' fuireach air ur son. An urrain dhuibh mo chuideachadh?" (Welcome to Scotland ! I was waiting for you. Can you help me ?)  - he greets you. But thanks to the translation circuit of the TARDIS you can understand and also speak Gaelic . "S urrainn" (I can) you reply in Gaelic, without even asking about the problem, as you typically do. 
His son, James V has trouble with Gaelic and appears to make pathetic spelling mistakes in the language. (No wonder James IV was the last king of Scots to speak Gaelic! ) To help the prince, the king has entrusted you to create a quick and dirty spell checker for Gaelic. 
But do not fear, though Gaelic spelling might look horrendous (Perhaps not as complex as Gallifreyan!). There are some fundamental rules to Gaelic spelling.
(i) Caol ri caol is leathann ri leathann (Slender with slender and broad with broad)
Within a word, a consonant or a group of consonants should always be preceded and followed by the same class of vowels. If a slender vowel precedes the consonant, it should always be followed by another slender vowel. And likewise for broad vowels.
Slender vowels : [e i]
Broad vowels : [a o u]
smaoineachadh, nighean, tiocaid, eile, mise are correct.
But furich, cudeachd, dhaichaidh, thuisa are incorrect. 
(ii)  Seimheachadh (Lenition)
If a word is preceded by "mo", "gam", "gad", do" and "gle" the following word must have 'h' as the second letter.  But words starting with n,l,r are exempted from this rule. So, they must not have "h" as the second letter.
The following are correct: mo mhathair  gad thuigsinn, do leabhar 
But these are incorrect: gle math, mo cat,  do nhighean
(iii) Gaelic alphabet doesn't contain the letters - j,k,q,v,w,x,y,z. 
Uilleam is correct, while William is wrong

Your TARDIS has taken you back in time to the castle of James IV, the King of Scots himself.  "Failte gu Alba! Bha mi a' fuireach air ur son. An urrainn dhuibh mo chuideachadh?" (Welcome to Scotland ! I was waiting for you. Can you help me ?)  - he greets you. But thanks to the translation circuit of the TARDIS you can understand and also speak Gaelic . "S urrainn" (I can) you reply in Gaelic, without even asking about the problem, as you typically do. 

His son, James V has trouble with Gaelic and appears to make pathetic spelling mistakes in the language. (No wonder James IV was the last king of Scots to speak Gaelic! ) To help the prince, the king has entrusted you to create a quick and dirty spell checker for Gaelic. 

But do not fear, though Gaelic spelling might look horrendous (Perhaps not as complex as Gallifreyan!). There are some fundamental rules to Gaelic spelling.

(i) Caol ri caol is leathann ri leathann (Slender with slender and broad with broad)

Within a word, a consonant or a group of consonants should always be preceded and followed by the same class of vowel. If a slender vowel precedes the consonant, it should always be followed by another slender vowel. And likewise for broad vowels.

Slender vowels : [e i]

Broad vowels : [a o u]

smaoineachadh, nighean, tiocaid, eile, mise are correct.

But furich, cudeachd, dhaichaidh, thuisa are incorrect. 

(ii)  Seimheachadh (Lenition)

If a word is preceded by "mo", "gam", "gad", "do" and "gle" the following word must have 'h' as the second letter.  But words starting with n,l,r are exempted from this rule. So, they must not have "h" as the second letter.

The following are correct: mo mhathair  gad thuigsinn, do leabhar 

But these are incorrect: gle math, mo cat,  do nhighean

(iii) Gaelic alphabet doesn't contain the letters - j,k,q,v,w,x,y,z. 

Uilleam is correct, while William is wrong

Input

Input will be a sentence entirely in lowercase, without any punctuation.

Output

Given, a sentence the program must be able to print a message - "Tha sin ceart" (That's correct) or "Tha sin cearr" (That's wrong) and then list out all incorrect words in exact order of occurance. 

Example

Input:
smaoinich mu do dheidheinn

Output:
Tha sin ceart 
Input:
tha mi gle toilichte gun theid thu dhachigh am blaidhna

Output:
Tha sin cearr
toilichte
dhachigh
blaidhna

Added by:Jakub Dostal
Date:2014-04-05
Time limit:5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All

hide comments
2018-06-06 07:31:38
Input DOES contain punctuation, possibly words like "bharail-sa" but every way I treated these cases resulted in WA.

Don't waste your time unless you actually speak Gaelic.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.