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
A museum has a collection of old posters advertising events of various kinds (theatre, sport, fairs, lectures etc.). It wishes to keep a record of these, containing, for each poste

A digital signature is   encrypting information

If various load generators need to access the similar physical files, rather than having to remember to copy the files every time they change, each load generator can reference a c

When your shell is waiting for input from the user, it should first print a prompt. The prompt should consist of the current working directory followed by the _>_ character. Here i

Dear sir, I want to read Excel file and display it in grid view(the headings in excel file should be grid view column heading).This should be coded in C# Windows forms Application

Explain CONGESTION. CONGESTION: This is uneconomic to provide sufficient equipment to carry entire traffic that could possibly be given to a telecommunication system. Inside

Explain the Significance of Binary Data Controlled devices generally contain registers that are made up of binary digits (bits). The following illustration shows how these regi

Objectives of object oriented analysis After going through this unit, you should be able to: define the concepts of the objects in the system; express desired syste

if 2 forces are equal at an angle alpha between them - its resultant R and its direction

BIOS - Basic Input Output System, Power On Self Test (POST) and Loading Bootloader from the Hard disk drive Boot Sector is being completed by BIOS. It started the system for