c++, Computer Engineering

Assignment Help:
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'').


Related Discussions:- c++

Ruby, Discuss about variables and assignmesnt statements

Discuss about variables and assignmesnt statements

Describe program control instructions, Q. Describe Program Control Instruct...

Q. Describe Program Control Instructions? These instructions specify conditions for altering the sequence of program execution or we can say in other words that the content of

What is canonical and standard forms, Q.What is Canonical and Standard Form...

Q.What is Canonical and Standard Forms? An algebraic expression can express in two forms: i) Sum of Products   (SOP) for example (A . B¯) + (A¯ . B¯)            ii) Produ

What are subroutines, What are subroutines? Subroutines are program mo...

What are subroutines? Subroutines are program modules, which can be known  from other ABAP/4 programs or within the similar program.

Atom-collider, Many physicists believe that the universe is governed by a s...

Many physicists believe that the universe is governed by a single system. A system which is capable of describing the behaviour of the very large (stars and planets) and the very s

Predicate logic - artificial intelligence, Translate the following sentence...

Translate the following sentences into predicate logic, using Russell's theory of definite descriptions to represent the article the. a. The wizzard of Oz fell. b. Everyone a

Knowledge of the environment - artificial intelligence, Knowledge of the E...

Knowledge of the Environment: We must discriminate between knowledge an agent receives through its sensors and knowledge about the world from which the input comes. The world

What is the use of fork and exec system calls, What is the use of fork and ...

What is the use of fork and exec system calls?  Fork is a system call by which a new process is formed. Exec is also a system call, which is used after a fork by one of the two

Build and explain a prototype model-uml, International Coal Coal-fire...

International Coal Coal-fired Power Generation Compared with other fossil fuels, burning coal produces relatively large amounts of atmospheric pollutants: carbon dioxide

Entrepreneurship, explain succession planning and strategies for harvesting...

explain succession planning and strategies for harvesting and ending the venture

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd