not supposed to use foldr in longest_string2