CDK Global Interview Question

Duplicates in string code, Optimization