You are given 3 strings, p, q, and r. You have to make r from p and q such that characters picked from p and q have their order preserved. Find the number of ways. Note, you have to pick atleast one character from both the strings.
Bolded part made the question tough.