Minimum insert to form a palindrome
refactoring