#C4133. Lucky Ticket
Lucky Ticket
Lucky Ticket
You are given a ticket represented as a string of digits. A ticket is considered lucky if the sum of its first half of digits equals the sum of its second half of digits. For example, if the ticket is '1230', the first half is '12' (with sum 1+2=3) and the second half is '30' (with sum 3+0=3), so the ticket is lucky.
Your task is to determine for each ticket whether it is lucky or not.
Note: Each ticket will have an even number of digits.
inputFormat
The first line contains an integer n representing the number of tickets. Each of the following n lines contains a string representing a ticket.
For example:
3 1230 56789976 12344321
outputFormat
For each ticket, output a single line with either YES
if the ticket is lucky, or NO
otherwise.
For example, the output corresponding to the sample input above is:
YES NO YES## sample
3
1230
56789976
12344321
YES
NO
YES
</p>