J.P. Morgan interview question

A leetcode easy problem with string manipulation