AST Consulting Interview Question

DSA Questions, about the string