hackerrank special string again problem solution in python

visit shbcf.ru