c++, Computer Engineering

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".



1<=|N|<=500, N will only contain lower case alphabets (''a''-''z'').

Posted Date: 8/14/2014 3:45:13 AM | Location : USA

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

Write discussion on c++
Your posts are moderated
Related Questions
in building a suspension bridge a cable is to be stretched from the top of a pier to a point 852.6 ft. from it''s foot. if from this point the angle of elevation of the top of the

Define service (within R/3)? A service is a process or group of processes that perform a exact system function and often give an application-programming interface for other pr

Factory methods that will be used to make objects just like in a static way.

What do you mean by ‘Bresenham’s him Algorithm?

Q. Explain about Quarter Inch Cartridge Tapes? Quarter Inch Cartridge Tapes (QIC Standard): These tape cartridges record information sequentially in a track with one head. Wh

how to implement a modified distribution method using c/c++

Q. How to reduce total amount of disk space in FTP? FTP service compress files to reduce total amount of disk space the files require. Before transferring a file user should te

The following is taken from the first edition of the Set Book. We have included this because we find these characteristics helpful. We will refer to them later. In addition to t

Q. Explain how does CPU perform Read and Write operation on peripheral device taking suitable example in case of Asynchronous Technique. Differentiate Memory mapped and Isolated

Existential Introduction: Now if we have any sentence as, A, and variable, v, that does not occur in A, so then for any ground term, g, such occurs in A, than we can turn A in