MFLAR10 - Flowers Flourish from France

Fiona has always loved poetry, and recently she discovered a fascinating poetical form. Tautograms are a special case alliteration, which is the occurrence of the same letter at the beginning of adjacent words. In particular, a sentence is a tautogram if all of its words start with the same letter. 

For instance, the following sentences are tautograms:

  • Flowers Flourish from France
  • Sam Simmonds speaks softly
  • Peter pIckEd pePPers
  • truly tautograms triumph

Fiona wants to dazzle her boyfriend with a romantic letter full of this kind of sentences. Please help Fiona to check if each sentence she wrote down is a tautogram or not.

Input

Each test case is given in a single line that contains a sentence. A sentence consists of a sequence of at most 50 words separated by single spaces. A word is a sequence of at most 20 contiguous uppercase and lowercase letters from the English alphabet. A word contains at least one letter and a sentence contains at least one word.

The last test case is followed by a line containing only a single character ‘*’ (asterisk).

Output

For each test case output a single line containing an uppercase ‘Y’ if the sentence is a tautogram, or an uppercase ‘N’ otherwise.

Example

Sample input:
Flowers Flourish from France
Sam Simmonds speaks softly
Peter pIckEd pePPers
truly tautograms triumph
this is NOT a tautogram
*

Sample Output:
Y
Y
Y
Y
N

Added by:psetter
Date:2010-11-05
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:ACM ICPC2010 – Latin American Regional

hide comments
2015-06-03 18:01:57
http://www.spoj.com/problems/MFLAR10/en/ use this dushyant
2015-05-25 19:01:32 Dushyant Singh
When i click on english it gives Wrong problem code! How can i see the problem?
2014-12-22 23:17:18 Saksham
be careful single word is a tautogram and even of the leading spaces cost me 2wa
2014-12-15 15:20:35 kartikay singh
gets()isnt working here
help..
2014-12-12 20:29:52 e_coder
50th :)
2014-10-02 21:40:32 jack sparrow
don't add anything more other than mention in input u will get AC :D
2014-10-02 19:01:25 mayank
2016th user! on this as well as Traversing Grid! :)
2014-07-29 10:59:14 Aragon!!!
given cases are more than enough to solve... :D
2014-07-25 01:35:36 Naruto uzumaki
100 :)
2014-05-26 13:13:20 मोहन
Easy my 37th....:D
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.