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

hide comments
Aayush: 2012-12-19 19:40:00

getting WA :( Dont know why... I've checked all test cases..Ideas anyone?

Anuj_LuckFove!: 2012-12-05 06:40:56

easy one..still cost me 3-4 WAs :/

Last edit: 2012-12-05 06:41:57
Just Trying: 2012-06-24 20:36:41

Simple indeed :)

Anuj Arora: 2012-06-24 18:29:47

Fiona wants to write love letter to Shrek ......hahaha

Adhityaa: 2012-02-29 13:47:37

can some one give special test cases..
I'm getting WA...

Aditya Muttur: 2011-12-17 13:01:00

can there be more than 1 space btw 2 words?

BOND: 2011-12-16 13:41:16

Fiona !!!
why there are so much characters from movies in spoj questions ??

:-): 2011-12-14 15:03:39

yes, a single word is a tautogram.

RAJDEEP GUPTA: 2011-08-07 18:27:26

I am getting confused how to read inputs. Do i have to read it from a file or stdin?? and if it is stdin, then do I have to read all the i/p at once or reading one at a time and generating the o/p for that and then reading another i/p? please help!!

ViNiTH: 2011-07-18 04:04:15

ignore preceding and leading spaces and blank lines and voila AC.


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