Lucky Participants of CODEBETA

3

1 votes
Easy
Problem

While doing registrations, the co-ordinators of CODEBETA are assigning a TEAM ID to each participants.

A TEAM ID is considered lucky if the sum of the first half of the digits is equal to the sum of the second half.

Given a TEAM ID t, determine if it's lucky or not.

NOTE : Team id always contains even number of digits'

INPUT : 

FIRST line of input contains number of test cases n.

Next n lines contains Team id 't'.

OUTPUT :

Print 'lucky' if TEAM ID is lucky according to above condition otherwise print 'unlucky'.

INPUT CONSTRAINTS :

1 <= n <= 100

1 <=t <= 10^8

Sample Input
3
239017
999999
1230
Sample Output
unlucky
lucky
lucky
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

First line contains number of TEAM IDs i.e. 3

For ID 239017 sum of first half is 2+3+9 = 14 and sum of other half is 0+1+7=8, so it is unlucky as 14 is not equal to 8.

For ID 999999 sum of first half is 9+9+9 = 27 and sum of other half is 9+9+9=27, so it is lucky as 27 is equal to 27.

For ID 1230 sum of first half is 1+2 = 3 and sum of other half is 3+0 = 3, so it is lucky as 3 is equal to 3.

 

Contributers:
Editor Image

?