Pocket Gems interview question

KMP algorithm and sort color