Buggy python submission (verdict: Time Limit Exceeded):
import string

ALPHABETS = string.ascii_lowercase

s = input()
N = len(s)
MAX = 2 * 10 ** 5
a = 0
dp = {}
dp[0] = 0
bits = [2 ** i for i in range(26)]

for c in s:
    a = a ^ bits[ALPHABETS.index(c)]
    dp[a] = min(dp.get(a, MAX), min([dp.get(a ^ 2 ** j, MAX) if not j == -1 else dp.get(a ^ 0, MAX) for j in range(-1, 26)]) + 1)

print(dp[a] if dp[a] != 0 else 1)


Fixed submission:
s = input()
N = len(s)
a = 0
dp = {}
dp[0] = 0
bits = [2 ** i for i in range(26)]

for c in s:
    a = a ^ bits[ord(c)-ord('a')]
    dp[a] = min(dp.get(a, N), min([dp.get(a ^ bit, N) for bit in bits]) + 1)

print(dp[a] if dp[a] != 0 else 1)

Buggy python submission (verdict: Time Limit Exceeded):
import string

ALPHABETS = string.ascii_lowercase

s = input()
N = len(s)
MAX = 2 * 10 ** 5
a = [0] * (N + 1)
for i, c in enumerate(s):
    idx = ALPHABETS.index(c)
    a[i+1] = a[i] ^ (2 ** idx)

opt = [0] * (N + 1)
dp = {}
dp[0] = 0
for i in range(1, N + 1):
    dp[a[i]] = min(dp.get(a[i], MAX), min([dp.get(a[i] ^ 2 ** j, MAX) if not j == -1 else dp.get(a[i] ^ 0, MAX) for j in range(-1, 26)]) + 1)

print(dp[a[N]] if dp[a[N]] != 0 else 1)


Fixed submission:
s = input()
N = len(s)
a = 0
dp = {}
dp[0] = 0
bits = [2 ** i for i in range(26)]

for c in s:
    a = a ^ bits[ord(c)-ord('a')]
    dp[a] = min(dp.get(a, N), min([dp.get(a ^ bit, N) for bit in bits]) + 1)

print(dp[a] if dp[a] != 0 else 1)

Buggy python submission (verdict: Time Limit Exceeded):
import string

ALPHABETS = string.ascii_lowercase


def is_avairable(a):
    return bin(a).count('1') <= 1

s = input()
N = len(s)
a = [0] * (N + 1)
for i, c in enumerate(s):
    idx = ALPHABETS.index(c)
    a[i+1] = a[i] ^ (2 ** idx)

opt = [0] * (N + 1)
dp = [2 * (10 ** 5) + 1] * (2 ** 26)
dp[0] = 0
for i in range(1, N + 1):
    ns = [dp[a[i] ^ 2 ** j] if not j == -1 else dp[a[i] ^ 0] for j in range(-1, 26)]
    mn = min(ns)
    opt[i] = mn + 1
    if dp[a[i]] > opt[i]:
        dp[a[i]] = opt[i]

print(opt[N])


Fixed submission:
s = input()
N = len(s)
a = 0
dp = {}
dp[0] = 0
bits = [2 ** i for i in range(26)]

for c in s:
    a = a ^ bits[ord(c)-ord('a')]
    dp[a] = min(dp.get(a, N), min([dp.get(a ^ bit, N) for bit in bits]) + 1)

print(dp[a] if dp[a] != 0 else 1)

Buggy python submission (verdict: Time Limit Exceeded):
import string

ALPHABETS = string.ascii_lowercase


def is_avairable(a):
    return bin(a).count('1') <= 1

s = input()
N = len(s)
a = [0] * (N + 1)
for i, c in enumerate(s):
    idx = ALPHABETS.index(c)
    a[i+1] = a[i] ^ (2 ** idx)

opt = [0] * (N + 1)
dp = [2 * (10 ** 5) + 1] * (2 ** 26)
dp[0] = 0
for i in range(1, N + 1):
    min = 2 * (10 ** 5) + 1
    for j in range(-1, 26):
        n = dp[a[i] ^ 2 ** j] if not j == -1 else dp[a[i] ^ 0]
        if n < min:
            min = n
    opt[i] = min + 1
    if dp[a[i]] > opt[i]:
        dp[a[i]] = opt[i]

print(opt[N])


Fixed submission:
s = input()
N = len(s)
a = 0
dp = {}
dp[0] = 0
bits = [2 ** i for i in range(26)]

for c in s:
    a = a ^ bits[ord(c)-ord('a')]
    dp[a] = min(dp.get(a, N), min([dp.get(a ^ bit, N) for bit in bits]) + 1)

print(dp[a] if dp[a] != 0 else 1)

Buggy python submission (verdict: Time Limit Exceeded):
import string

ALPHABETS = string.ascii_lowercase


def is_avairable(a):
    return bin(a).count('1') <= 1


s = input()
N = len(s)
a = [0] * (N + 1)
for i, c in enumerate(s):
    idx = ALPHABETS.index(c)
    a[i+1] = a[i] ^ (2 ** idx)

opt = [0] * (N + 1)
for i in range(1, N + 1):
    min = -1
    for j in range(i):
        if is_avairable(a[j] ^ a[i]):
            if opt[j] < min or min < 0:
                min = opt[j]
    opt[i] = min + 1
print(opt[N])


Fixed submission:
s = input()
N = len(s)
a = 0
dp = {}
dp[0] = 0
bits = [2 ** i for i in range(26)]

for c in s:
    a = a ^ bits[ord(c)-ord('a')]
    dp[a] = min(dp.get(a, N), min([dp.get(a ^ bit, N) for bit in bits]) + 1)

print(dp[a] if dp[a] != 0 else 1)