Smartcat interview question

Pretty standard small coding problems