Lucky Straight
InterviewTime limit1sMemory limit256 MB
Given an even-length number, decide whether the sum of its left-half digits equals the sum of its right-half digits, printing LUCKY or READY.
- Level
Easy2 of 10
- Topics
- String, Implementation, Math, Array
- Solved
- No attempts yet
Problem
In a certain game, the outboxer character has a skill called Lucky Straight. The skill is very powerful, but it cannot always be used: it can only be used when the score satisfies a specific condition.
The condition is as follows. Let the character's current score be N. Split the score N in half by digit count, and the sum of the digits in the left half must equal the sum of the digits in the right half. For example, if the current score is 123,402, the left half's digit sum is 1+2+3 and the right half's digit sum is 4+0+2, so both sums are 6 and Lucky Straight can be used.
Given the current score N, write a program that tells whether Lucky Straight can be used. If it can be used, print "LUCKY"; if it cannot, print "READY". The number of digits of the score N is always even. For example, a number such as 12,345, which has 5 digits, is never given as input.
Input
The first line gives the score N as an integer. (10 ≤ N ≤ 99,999,999) The number of digits of the score N is always even.
Output
On the first line, print "LUCKY" if Lucky Straight can be used, or "READY" if it cannot.