Longest Substring without Repeating Characters

I write it with python, but it can’t pass the judgement of Leetcode,
since time limit exceed