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
2014-04-16 21:07:54 ivar.raknahs
AC in one go.
easy with python
2014-03-27 16:54:58 RAJAT SINGH
finally got AC after two WA .....feeling confident
2014-03-27 16:37:53 RAJAT SINGH
why I am getting WA ...my ID is 11339316
2014-03-27 15:53:56 RAJAT SINGH
i don't know why i am getting WA .......plz give some more complex test cases
2014-02-15 16:48:54 Anubhav Balodhi
Easy... je ta'ime ^_^
2013-07-14 03:59:57 shashank
AC in first attempt
Easy Question
Very easy if you are doing it in java..
2013-07-13 12:31:13 Rudradeep Mukherjee
thanks @Aniket Kumar...I was doing the same silly mistake. Finally got AC. :)
2013-06-23 20:34:01 Shahbaaz
Bingo...:)
2012-12-27 11:07:17 Aniket Kumar
Easy ... bt be careful its 50 words not 50 alphabets ,, cost me 3 WA..
2012-12-25 15:18:57 Akb
According to the problem statement: "A word contains at least one letter and a sentence contains at least one word." After getting 3 WAs before final AC, I dont think so... :D
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.