Regex Substitution Hackerrank Solution