String Game
Practice
4 (38 votes)
Basic programming
Basics of implementation
Easy
Implementation
Problem
69% Success 14108 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

\(Player1\) and \(Player2\) decided to play a game. The game comprises of a String S which consist of lowercase English alphabets only and both players take alternative terms.

In each turn, a Player choose a character present in the string and remove all occurrences of the character. For each player to play his turn, there should be at least one character in the string. The Player who is not able to play his turn loses.

Your task is to find the winner of the game, if both the players play optimally and \(Player1\) plays the first turn.

Input Format :
The input starts with an integer T, the number of test cases.
Each test case contains an String S on a new line.

Output Format:
Print "\(Player1\)" if \(Player1\) Wins or "\(Player2\)" if \(Player2\) Wins (without quotes). For each test case, print the output in new line.

Constraints:
\(1 \le T \le 10\)
\(1 \le length \space of \space String \space S \le 10^{5}\)

All characters are lowercase English alphabets.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
19 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasy
Points:20
186 votes
Tags:
Ad-HocEasyMathOpen
Points:20
34 votes
Tags:
ImplementationBasic ProgrammingBasics of Greedy Algorithms