The Block Game - CodeChef Solution

Hey coders, today we are going to solve The Block Game CodeChef Solution whose Problem code is PALL01. The citizens of Byteland regularly play a game.

Hey coders, today we are going to solve The Block Game CodeChef Solution whose Problem code is PALL01.

The Block Game - CodeChef Solution

Task

The citizens of Byteland regularly play a game. They have blocks each denoting some integer from 0 to 9. These are arranged together in a random manner without seeing to form different numbers keeping in mind that the first block is never a 0. Once they form a number they read in the reverse order to check if the number and its reverse is the same. If both are same then the player wins. We call such numbers palindrome.

Ash happens to see this game and wants to simulate the same in the computer. As the first step he wants to take an input from the user and check if the number is a palindrome and declare if the user wins or not. 

Input

The first line of the input contains T, the number of test cases. This is followed by T lines containing an integer N.

Output 

For each input output "wins" if the number is a palindrome and "loses" if not, in a new line.

Constraints

1 <= T <= 20

1 <= N <= 20000

Input:

3
331
666
343

Output:

loses
wins
wins

Solution - The Block Game - CodeChef Solution 

Python 3

#Solution Provided by Sloth Coders
for i in range(int(input())):
    n = input()
    if n == n[::-1]:
        print("wins")
    else:
        print("loses")

Disclaimer: The above Problem (The Block Game) is generated by CodeChef but the Solution is provided by Sloth Coders.

Happy Coding !!

A Sloth Who loves to Code 

Also Read:

Sloth Coders is a Learning Platform for Coders, Programmers and Developers to learn from the basics to advance of Coding of different langauges(python, Java, Javascript and many more).

Post a Comment