Problem p03338 (python)

Fixed submission:
N = int(input())
text = input()
result = []
for i in range(N-1):
      counter = 0
      text1 = text[0:i+1]
      text2 = text[i+1:]
      if  "a" in text1:
            if "a" in text2:
                  counter = counter + 1
      if  "b" in text1:
            if "b" in text2:
                  counter = counter + 1
      if  "c" in text1:
            if "c" in text2:
                  counter = counter + 1
      if  "d" in text1:
            if "d" in text2:
                  counter = counter + 1
      if  "e" in text1:
            if "e" in text2:
                  counter = counter + 1
      if  "f" in text1:
            if "f" in text2:
                  counter = counter + 1
      if  "g" in text1:
            if "g" in text2:
                  counter = counter + 1
      if  "h" in text1:
            if "h" in text2:
                  counter = counter + 1
      if  "i" in text1:
            if "i" in text2:
                  counter = counter + 1
      if  "j" in text1:
            if "j" in text2:
                  counter = counter + 1
      if  "k" in text1:
            if "k" in text2:
                  counter = counter + 1
      if  "l" in text1:
            if "l" in text2:
                  counter = counter + 1
      if  "m" in text1:
            if "m" in text2:
                  counter = counter + 1
      if  "n" in text1:
            if "n" in text2:
                  counter = counter + 1
      if  "o" in text1:
            if "o" in text2:
                  counter = counter + 1
      if  "p" in text1:
            if "p" in text2:
                  counter = counter + 1
      if  "q" in text1:
            if "q" in text2:
                  counter = counter + 1
      if  "r" in text1:
            if "r" in text2:
                  counter = counter + 1
      if  "s" in text1:
            if "s" in text2:
                  counter = counter + 1
      if  "t" in text1:
            if "t" in text2:
                  counter = counter + 1
      if  "u" in text1:
            if "u" in text2:
                  counter = counter + 1
      if  "v" in text1:
            if "v" in text2:
                  counter = counter + 1
      if  "w" in text1:
            if "w" in text2:
                  counter = counter + 1
      if  "x" in text1:
            if "x" in text2:
                  counter = counter + 1
      if  "y" in text1:
            if "y" in text2:
                  counter = counter + 1
      if  "z" in text1:
            if "z" in text2:
                      counter = counter + 1
      result = result + [counter]

print(max(result))

Buggy submission (verdict: Runtime Error):
N = int(input())
text = input()
result = []
for i in range(N-2):
      counter = 0
      text1 = text[0:i+2]
      text2 = text[i+2:]
      if  "a" in text1 and text2:
          counter = counter + 1
      if  "b" in text1 and text2:
          counter = counter + 1
      if  "c" in text1 and text2:
          counter = counter + 1
      if  "d" in text1 and text2:
          counter = counter + 1
      if  "e" in text1 and text2:
          counter = counter + 1
      if  "f" in text1 and text2:
          counter = counter + 1
      if  "g" in text1 and text2:
          counter = counter + 1
      if  "h" in text1 and text2:
          counter = counter + 1
      if  "i" in text1 and text2:
          counter = counter + 1
      if  "j" in text1 and text2:
          counter = counter + 1
      if  "k" in text1 and text2:
          counter = counter + 1
      if  "l" in text1 and text2:
          counter = counter + 1
      if  "m" in text1 and text2:
          counter = counter + 1
      if  "n" in text1 and text2:
          counter = counter + 1
      if  "o" in text1 and text2:
          counter = counter + 1
      if  "p" in text1 and text2:
          counter = counter + 1
      if  "q" in text1 and text2:
          counter = counter + 1
      if  "r" in text1 and text2:
          counter = counter + 1
      if  "s" in text1 and text2:
          counter = counter + 1
      if  "t" in text1 and text2:
          counter = counter + 1
      if  "u" in text1 and text2:
          counter = counter + 1
      if  "v" in text1 and text2:
          counter = counter + 1
      if  "w" in text1 and text2:
          counter = counter + 1
      if  "x" in text1 and text2:
          counter = counter + 1
      if  "y" in text1 and text2:
          counter = counter + 1
      if  "z" in text1 and text2:
          counter = counter + 1
      result = result + [counter]

print(max(result))

Buggy submission (verdict: Runtime Error):
N = int(input())
text = input()
result = []
for i in range(N-2):
      counter = 0
      text1 = text[0:i+2]
      text2 = text[i+2:]
      if  "a" in text1 and text2:
          counter = counter + 1
      if  "b" in text1 and text2:
          counter = counter + 1
      if  "c" in text1 and text2:
          counter = counter + 1
      if  "d" in text1 and text2:
          counter = counter + 1
      if  "e" in text1 and text2:
          counter = counter + 1
      if  "f" in text1 and text2:
          counter = counter + 1
      if  "g" in text1 and text2:
          counter = counter + 1
      if  "h" in text1 and text2:
          counter = counter + 1
      if  "i" in text1 and text2:
          counter = counter + 1
      if  "j" in text1 and text2:
          counter = counter + 1
      if  "k" in text1 and text2:
          counter = counter + 1
      if  "l" in text1 and text2:
          counter = counter + 1
      if  "m" in text1 and text2:
          counter = counter + 1
      if  "n" in text1 and text2:
          counter = counter + 1
      if  "o" in text1 and text2:
          counter = counter + 1
      if  "p" in text1 and text2:
          counter = counter + 1
      if  "q" in text1 and text2:
          counter = counter + 1
      if  "r" in text1 and text2:
          counter = counter + 1
      if  "s" in text1 and text2:
          counter = counter + 1
      if  "t" in text1 and text2:
          counter = counter + 1
      if  "u" in text1 and text2:
          counter = counter + 1
      if  "v" in text1 and text2:
          counter = counter + 1
      if  "w" in text1 and text2:
          counter = counter + 1
      if  "x" in text1 and text2:
          counter = counter + 1
      if  "y" in text1 and text2:
          counter = counter + 1
      if  "z" in text1 and text2:
          counter = counter + 1
      result = result + [counter]

print(max(result))