programming, JAVA Programming

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Necklaces require polishing the jewels. Operationally, all jewels of the same colour can be polished in one sitting.

Damjibhai and Shamjibhai are two jeweler friends. They decide to play a simple game. The game comprises of removing the jewels for polishing, turn by turn. Once a jewel is removed from the necklace, all other jewels of the same colour are assumed to be removed for polishing from the necklace. The player who polished the most jewels, wins. Damjibhai being more senior, always gets a chance to play first (remove jewel from necklace first). If both players play optimally, find out if Damjibhai can win. The following are the rules of their game
Jewels can only be removed for polishing from either end of the necklace (i.e. head or tail)
Once a jewel type is removed from the necklace, all other instances of the same jewel type is treated as polished by the person who removed the jewel
For purpose of this problem, we have represented the necklace as a string and each character of the string is a Luminous Jewel

Input Format:

First line starts with T, number of test cases. Each test case T contains a necklace (N).

Output Format:

Print "Yes" if Damjibhai can win, else print "No".

Constraints:
1<=T<=100

1<=|N|<=500, N will only contain lower case alphabets (''a''-''z'').
Posted Date: 8/14/2014 2:55:02 AM | Location : USA







Related Discussions:- programming, Assignment Help, Ask Question on programming, Get Answer, Expert's Help, programming Discussions

Write discussion on programming
Your posts are moderated
Related Questions
Write a program that takes as input a sequence of transactions of the form

Specifications 1. readNumberOfEntries → This function will ask the user for a value greater than or equal to two. The function will keep asking values as long as the user prov

What are Commonsense Guidelines to prevent viruses? Discuss about Antivirus as well. Commonsense Guidelines to avoid viruses are as follows: 1. Do not open attachment of unwant

Normal 0 false false false EN-US X-NONE X-NONE

Add WordPress color picker to plug-in text field Project Description: I have a simple plug-in that needs the built-in Word Press color picker added to one of the text input f

Include Photo Upload feature to Android App with Google App Engine Project Description: I have one small Android App skeleton that requires some features added to and backed

How virtual communities are formed? How these are different from other Communities? Give examples. Virtual Communities are interest-based communities. Members along with genera

Normal 0 false false false EN-US X-NONE X-NONE

Need software to print bills on A4 paper in the format provided. The details are shown below - 1. Serially generated Invoice Number. 2. Appropriate fields in the invoice have

How to write a program that converts US dollars into Canadian dollars.The program let the user enter an amount in US dollars and display it equivalent value in Canadian dollars whe