Problem Statement | |||||||||||||
NOTE: This problem statement contains images that may not display properly if viewed outside of the applet.
Taro shows a magic trick to Hanako. Taro: Hello Hanako. I'll show you a magic trick. Please imagine a positive integer less than or equal to 16. Hanako: OK. I imagined it. Taro: (Taro shows card 1 to Hanako.) Does this card contain your number? Hanako: Yes. Taro: (Taro shows card 2 to Hanako.) Does this card contain your number? Hanako: No. Taro: (Taro shows card 3 to Hanako.) Does this card contain your number? Hanako: Yes. Taro: (Taro shows card 4 to Hanako.) Does this card contain your number? Hanako: Yes. Taro: Your number is 5! (Card 1 contains 1, 2, 3, 4, 5, 6, 7 and 8. Card 2 contains 1, 2, 3, 4, 9, 10, 11 and 12. Card 3 contains 1, 2, 5, 6, 9, 10, 13 and 14. Card 4 contains 1, 3, 5, 7, 9, 11, 13 and 15.) Your task is to write a program that simulates this magic trick. You are given Hanako's answers in the String answer. The i-th character is 'Y' if she answered "yes" to the i-th question, and 'N' if she answered "no" to the i-th question. Return the integer Hanako imagined. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | answer will contain exactly 4 characters. | ||||||||||||
- | Each character in answer will be 'Y' or 'N'. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|