Submission to Twice programming challenge