Computer Science, asked by limitlessskylight, 5 hours ago

John and Joe are playing a game. Initially, they have a string of

length n consisting of zeros and ones only. Both the players are playing game optimally taking alternate turns. In each turn, the player removes only one occurrence of either substring "01" or "10" from anywhere in the given binary string. The player who cannot make a move loses the game. If John makes the first move, he wonders who will win the game. You, being his friend, help him solve his problem.

Input Format:

The first line contains an integer denoting the number of test cases.
The first line of each test case contains an integer n, length of the string.
The second line of each test case contains the initial string.

Constraints
1<=t<=50
1<=n<10^5
It is guaranteed that initial string consists of zeros and ones only.

Output Format:
For each test case, if John wins the game, print in a new line "John" (without quotes) otherwise print "Joe" (without quotes).

Sample Input 0:
2
3
101
5
11010

Sample Output 0:
John
Joe​

Answers

Answered by parmodkumar50694
12

Answer:

each test case contains the initial string.

Constraints

1<=t<=50

1<=n<10^5

It is guaranteed that initial string consists of zeros and ones only.

Output Format:

For each test case, if John wins the game, print in a new line "John" (without quotes) otherwise print "Joe" (without quotes).

Explanation:

MARK AS BRINLIEST

Similar questions