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
2011-06-20 10:43:15 g3
Is a single word considered as a tautogram ?
2011-03-27 21:38:22 Kunal Kapadia
@Manpreet Singh: Nice reply :)
2011-01-26 20:27:49 Max
@seshadri : I am getting wrong answer even though my code is giving write answers for sample input as well as all the strings i've tried. what could be the reason ?
2011-01-26 01:35:06 :(){ :|: & };:

Good work with the input file,initially I assumed the worst.
2011-01-03 09:22:18 Manpreet Singh
i think u should practice more often
2010-11-10 06:59:59 Seshadri R
Can this problem be moved to Tutorials? (I am always of the opinion that if my first ever submission is AC, then it is not a challenging problem)
2010-11-09 19:35:18 Pranay
can't understand why am i getting runtime error in java

Last edit: 2010-11-10 04:29:59
2010-11-06 14:08:25 mafia
the input is:

Flowers Flourish from France
Sam Simmonds speaks softly

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.