solution for length of Longest Substring