For this Question: Given a string s, find the length of the longest substring without repeating characters.

<b>Note</b> : String contains spaces also.First Line contains the input of the string.

<b> Constraints </b>
1 <= string.length <= 50000
s consists of English letters, digits, symbols, and spaces.Print the length of the longest substring without repeating characters.Sample Input: 
abcabcbb

Sample Output:
3

Explanation: The answer is "abc", with a length of 3., I have written this Solution Code: def lengthOfLongestSubstring(s):
    ans = 0
    sub = ''
    for char in s:
        if char not in sub:
            sub += char
            ans = max(ans, len(sub))
        else:
            cut = sub.index(char)
            sub = sub[cut+1:] + char
    return ans

s = input()
print(lengthOfLongestSubstring(s)), In this Programming Language: Python, Now tell me if this Code is compilable or not?