Eleviant Tech Interview Question

train ticket processing code, remove the largest sub-word from the string