Turing Interview Question

2 DSA question about strings.