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 a and b made only of 0 and 1, then hand them to Junmin. Junmin wins if he turns a into b. He may use the following two operations any number of times, in any order.
- He can remove the first character of a. For example,
1001 becomes 001. When a is empty, nothing can be removed.
- He can append parity(a) to the end of a. For example,
1000 becomes 10001. parity(a) is 1 when the number of 1s in a is odd, and 0 otherwise.
Junmin is bad at this game, so he asks whether he can win. Write a program that reads a and b and decides whether Junmin can win.