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

  You need to train for 10 weeks

You are preparing for a marathon. In order to prepare, you need to train for 10 weeks, running an increasing number of miles per week, starting at running at least 2 miles your first week up to 26 miles by week 10.

  Create a driver class in java

Your project is to create a driver class that uses SuperJavaIceCreamClass.

  Write a method called range that returns the range of value

Write a method called 'range' that returns the range of values in an array of integers. The range is defined as 1 more than the difference between the maximum and minimum values in the array. For example, if an array called list contains the value..

  Write java programming to show number of credits for course

Write the java programming to solve following problem. We are given a student's marks in Calculus 1, CS1, and Physics 1 (each mark being between 0 and 100) also number of credits for each course.

  Write applet which reads five numbers-draw equivalent stars

Write the applet which reads five numbers (each between 1 and 30). For each number read, your program must design line containing that number of adjacent asterisks.

  Write program with jframe to enter series of names

Write a program with JFrame which permits user to enter series of friends' names and phone numbers and creates file from entered data.

  Write a generic class

Write a generic class (using Java generics) called Pair that stores two values of the generic type.  It should have a constructor to set them, two methods getfirst() and getsecond() to retrieve them.

  Create and implement class called date to store month

Create and Implement the class called Date which has data members to store month (as a number), day, year, and name of month.

  Java applet to find how much federal tax we need to pay

Write a java applet to determine how much federal tax we need to pay assuming the tax rate is 12%.  Ask the taxable income.

  Write a program that asks the user to enter three names

Write a program that asks the user to enter three names

  Prepare address book java application

Prepare an application that reads the contents of your address book file and prepare a user guide that includes a description of the functionality of your overall address book system.

  Discuss how an interface differs from a class

Discuss how an interface differs from a class, how interfaces are defined, and what does implementing an interface mean.

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