Output: Standard Output (stdout)
Memory limit: 100 megabytes
Time limit: 1.0 seconds
The Dobson family consists of Mum, Dad and daughter Abbey. They are a bit strange as they will only purchase towels which are white or blue. Mum and Dad don’t care which colour they have but Abbey will only take a blue towel.
They have a very big linen cupboard with only one stack of towels in it. Your job is to tell them the colours of the towels left in the pile after family members have repeatedly taken a towel. None are replaced. They take towels from the top of the pile, except for Abbey. She will take the blue towel closest to the top, if the next available one (on the top) isn’t blue.
There are two lines, each containing a string. The first, T, contains the colours of the towels, either B (Blue) or W (White). The left most towel is assumed to be on the top of the pile. The length of T is L_1. The second, F contains the first letters of the family members who took a towel. M for Mum, D for Dad and A for Abbey. The length of F is L_2.
It is guaranteed that there is always a blue towel available for Abbey and that there will never be more towel requests than towels available.
Print the final value of T or “None” if all the towels have been taken.
- 0 \le L_1 \le 40
- 0 \le L_2 \le 40
- L_2 \le L_1
Sample Input 1
Sample Output 1
Sample Input 2
Sample Output 2