check both length and if first and last are equal