Longest Substring without Repeating Characters

I have tried to use python to solve this problem, however with the same
algorithm and method, python always report the time exceeded! So I use
C++ to solve it, the running time is 100ms, that’s ok!