Viasat interview question

one string manipulation question and one state machine