State Farm interview question

String leetcode question which was very easy.