HackerEarth Modify Sequence