Luminous jewels - the polishing game

Assignment Help JAVA Programming
Reference no: EM13264992

Luminous Jewels - The Polishing Game

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

1. Jewels can only be removed for polishing from either end of the necklace (i.e. head or tail)

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

3. 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').

Sample Input and Output

SNo.

Input

Output

1

2
aba
abbcgdffe

Yes
No

Reference no: EM13264992

Questions Cloud

What does the lower control limit tell us : What does the upper control limit of either a p, np, c, or u chart tell us about the process? What does the lower control limit tell us?
What is the probability that in the next sample of 25 flight : At any given moment, the airport managers estimate that there is a 1% chance of a runway incursion (near-miss). What is the probability that in the next sample of 25 flights, 1 or fewer runway incursions will occur?
Characterize public health issues : Differentiate between the three centuries.? What are some of the issues that define and characterize public health issues and progress in the the (18th - 19th) and 20th centuries?
Find direction and magnitude of the frictional force : A 1,576-kg car is moving down a road with a slope (grade) of 11% while slowing down at a rate of 3.6 m/s^2. find direction and magnitude of the frictional force
Luminous jewels - the polishing game : 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
What is the probability that in the next sample : At any given moment, the pipeline managers estimate that 1.5% of the seams will need repair. What is the probability that in the next sample of 25 seams, 2 or fewer of the seams will need repair?
Liquid gasoline will burn but gasoline vapour will explode : Liquid gasoline will burn, but gasoline vapour will explode. people who work in papaya-processing plants have to wear gloves.
What is the ucl : The following information and chart is data for these final inspections. Each sample represents one ship (n = 1). Create a c chart.
What is the dispersion of the outgoing beam : A horizontal incident beam consisting of white light passes through an equilateral prism. What is the dispersion (thetaV -thetaR) of the outgoing beam

Reviews

Write a Review

JAVA Programming Questions & Answers

  Length of the string in order to reserve space

To determine the length of the string in order to reserve space for the new string use the library routine strlen. Register a1 contains a pointer to the string to measure and on return register a1 has the number of characters in the string. You..

  Create online store web site

the Java and JSP source codes and SQL scripts for creating a database in Oracle - any configuration files used

  Java program to compute invoice for client

You need a java program to compute the invoice for client and then print out invoice to the screen. The consulting rate is $200 per hour.

  Create a program that develops an amortization schedule

Create a program that develops an amortization schedule. Your program should be written as a Java applet.

  Java tv''s newest owner! java tv is the greatest tv channel

Java TV's newest owner! Java TV is the greatest TV channel ever, and it prides itself in its 24 hour interesting ' programming'. To help you run this channel you will need to write a  dynamic  program that uses  Data Lists  to store all its TV show i..

  Write java applet for costco gas station

Write a java applet for costco gas station. The applet will first ask you whether you are a costco customer, then the grade of gas you want to use: grade 87, 89, or 91.

  Java program to print strings given at command line

Write down program Average.java to print strings which it is given at command line, one per line. If nothing is given at command line, then print "No arguments".

  Java application to declare and create a vector

Write a java application that perform the following task: declare and create a vector with initial size of 10, increment of 2

  Mvc pattern and servlet

When you use the MVC pattern, the controller directs the flow of control to

  Java program that computes a ride you took in taxi

Write a java program that computes a ride you took in taxi. The bill computed based on an initial cost plus the taxi charges 0.5 dirham every 0.3 km.

  That uses a library database of books

Write a Java program that uses a library database of books and patron data, as described in Exercise R22.2. Patrons should be able to check out and return books

  Ask user to enter a list of names

Write a program that ask a user to enter a list of names. When you finish, The program will show the total number of characters in all the names.

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