Viasat Interview Question

one string manipulation question and one state machine