Wells Fargo Interview Question

String chain problem that requires recursion or DP.