started solving problem 4
palindrome checking method functional