Menu Close

Find out the winner of the game from the given statistics

Arif likes to play volley ball. He found some statistics of matches which described who won the points in order. A game shall be won by the player first scoring 11 points except in the case when both players have 10 points each, then the game shall be won by the first player subsequently gaining a lead of 2 points. 

Could you please help the Arif find out who the winner was from the given statistics? (It is guaranteed that statistics represent always a valid, finished match.)

Input:
The first line of the input contains an integer 'T', denoting the number of test cases. The description of 'T' test cases follows. 

Each test case consist a binary string 'S', which describes a match. 
'0' means Arif lose a point, whereas '1' means he won the point.

Output:
Print the output on a separate line a string describing who won the match. 
If Arif won then print "WIN" (without quotes), otherwise print "LOSS" (without quotes).
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main()
{
  char matchscenario[102];
  int t,i,j,count=0;
  scanf("%d",&t);
  for(i=0;i<t;i++)
  {
    scanf("%s",matchscenario);
    for(j=0;j<strlen(matchscenario);j++){
        if(matchscenario[j]-'0'!=0)
        count++;
    }
    if(count<11)
    printf("LOSS\n");
    else
    printf("WIN\n");
    count=0;
  }

	return 0;
}

INPUT_1:
4
0101111111111
11100000000000
10110101101010
1110010110110

OUTPUT:
WIN
LOSS
LOSS
LOSS


INPUT:
6
0001111111111
11100000000000
1001111111111
1000110100101
1111001110011
1000100111011

OUTPUT:
LOSS
LOSS
WIN
LOSS
LOSS
LOSS



Morae! Q