Hackerrank String Transformation Codeforces