結果 : compare first and last character of string python