State Farm Interview Question

String leetcode question which was very easy.