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

Constraints:

1<=T<=100

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
Write a Verilog code for synchronous and asynchronous reset? Synchronous  reset, synchronous means clock dependent so reset must not be present in sensitivity disk eg: alway

What is Reflection?  It extends the benefits of metadata by permitting developers to inspect and use it at runtime. For example, dynamically verify all the classes contained in

a. Describe function declaration, function definition and function cell using a suitable example. Explain the function prototype? b. What is function overloading? When do we use

What do you mean by work flow automation? Work Flow Automation: Organizations frequently standardize processes across the association and encourage users to accept them. E

What are the Difference between $display and $strobe Difference between $display and $strobe is that $strobe displays parameters at the very end of current simulation time unit

What is WMFC? WMFC if the control signals that causes the processor's control circuitry to wait for the arrival of the MFC signal.

What is an "on request Field" statement? ON REQUEST The ABAP/4 Module is known as only if the user has entered the value in the field value as the last screen display .Th

Address translation with dynamic partition : Given figure shows the address translation process with dynamic partitioning, where the processor provides hardware support for

Continuous or Discrete - artificial intelligence: The behaviour of the coming data in from the environment will change how the agent should be programming. In particular, the

Explain POP (Post Office Protocol). The Post Office Protocol gives remote access to an electronic mail box. The protocol permits a user's mailbox to reside on a computer which