Binary Game
Time limit1sMemory limit256 MB
Read two binary strings and decide whether the first can reach the second by deleting the front character or appending the current parity bit.
Problem
Junmin was fishing with his friends Jaehyun and Sunyoung. Three hours passed without a single catch, so the other two got bored and started a binary game to tease him.
Jaehyun and Sunyoung write two strings and made only of 0 and 1, then hand them to Junmin. Junmin wins if he turns into . He may use the following two operations any number of times, in any order.
- He can remove the first character of . For example,
1001becomes001. When is empty, nothing can be removed. - He can append parity() to the end of . For example,
1000becomes10001. parity() is 1 when the number of 1s in is odd, and 0 otherwise.
Junmin is bad at this game, so he asks whether he can win. Write a program that reads and and decides whether Junmin can win.
Input
The first line has the string and the second line has the string . Both strings consist only of 0 and 1, and the length of each string is between 1 and 1,000.
Output
Print VICTORY if Junmin can win, and DEFEAT otherwise.