n,k=map(int,input().split())
string=input()
arr=list(string)
length=len(string)
l=0
d=ord(arr[0])
for i in range(length):
    if ord(arr[i]) == ord(arr[0]):
        l+=1

for i in range(length):
    if ord(arr[i])>d:
        d=ord(arr[i])

if d<ord('A')+k-1:
	print('0')
else:
    for i in range(65,64+k):
            t=0
            for j in range(length):
                if ord(arr[j])==i:
                    t=t+1
            if t<l:
                print(t)
                l=t

    print(l*k)


k = int(input().split()[1])
s = input()
print(k * min(s.count(chr(ord('A') + i)) for i in range(k)))


k = int(input().split()[1])
s = input()
print(k * min(s.count(chr(ord('A' + i)) for i in range(k)))


import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,k=LI()
  l=list(S())

  sl=list(set(l))
  check=[0]*len(sl)

  ans=0
  for x in l:
    check[sl.index(x)]+=1
    ans=max(ans,min(check))

  return ans*k

# main()
print(main())


import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,k=LI()
  l=list(S())

  sl=set(l)
  if len(sl)<k:
    return 0

  sl=list(sl)
  check=[0]*len(sl)
  c=0
  for x in l:
    y=sl.index(x)
    if check[y]>c%k+1:
      pass
    else:
      check[y]+=1
      c+=1

  return sum(check)//k*k

# main()
print(main())


import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# A~Z -- START --
alf=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
# A~Z --- END ---

def main():
  n,k=LI()
  s=list(S())

  a=alf[:k]
  # print(a)

  cnt=[0]*k
  for x in s:
    ind=alf.index(x)
    if ind+1>k:
      pass
    else:
      cnt[ind]+=1

  return min(cnt)*k

# main()
print(main())


a,b=map(int,input().split())
s=str(input())
x=set(s)
l=list(x)
l2=list(s)
l1=len(l)
z=a
if b>len(x):
	print(0)
else:
	for i in range (l1):
		if l[i] in l2:
			y=l2.count(l[i])
			if y<z:
				z=y
	print(z*b)


n,k=map(int,input().split())
a=input()
l=[]
for i in range(k):
	s=a.count(chr(ord('A')+i))
	l.append(s)
print(min(l)*k)


# import sys
# sys.stdin=open('input.in','r')
# sys.stdout=open('output.out','w')
d={}
n,m=map(int,input().strip().split()[:2])
l=input()[:n]
k=10**7
for x in l:
	if x not in d:
		d[x]=1
	else:
		d[x]+=1
if len(d)!=m:
	print(0)
else:
	for x in d:
		k=min(d[x],k)
	print(k*m)


n, k = map(int, input().split())
a = input()
letters = [0] * k
for el in a:
    letters[ord(el) - ord("A")] += 1
print(min(letters) * k)


n, k = map(int, input().split())
s = input()
a = [0] * k
b = 0

for c in s:
    b = b * 10 + ord(c) - ord('A') + 1

for c in str(b):
    a[int(c) - 1] += 1

f1 = False
l = min(a) * k
for t in range(l, -1, - k):
    for i in range(0, n - t + 1):
        f = True
        sub = s[i : i + t]
        for c in sub:
            if sub.count(c) != t // k:
                f = False
        if f and not f1:
            print(t)
            f1 = True
            break


n, k = map(int, input().split())
s = input()
a = [0] * k
b = 0

for c in s:
    b = b * 10 + ord(c) - ord('A') + 1

for c in str(b):
    a[int(c) - 1] += 1

f1 = False
l = min(a) * k
print(l)


n, k = map(int, input().split())
s = input()
a = [0] * k
b = 0

for c in s:
    b = b * 10 + ord(c) - ord('A') + 1

for c in str(b):
    a[int(c) - 1] += 1
col = 0
for x in a:
    if x != 0:
        col += 1
l = min(a) * k
print(l)


n, k = map(int, input().split())
s = input()
a = [0] * k
b = 0

for c in s:
    b = b * 10 + ord(c) - ord('A') + 1

for c in str(b):
    a[int(c) - 1] += 1

f1 = False
l = min(a) * k
if l == n:
    print(l - k)
else:
    print(l)


n, k = map(int, input().split())
s = input()
a = [0] * k
b = 0

for c in s:
    b = b * 10 + ord(c) - ord('A') + 1

for c in str(b):
    a[int(c) - 1] += 1

f1 = False
l = min(a) * k
if l == n:
    print(l - min(a))
else:
    print(l)


# f = open('test.txt')

# input = f.readline

from collections import Counter

n, k = input().strip().split()
n, k = int(n), int(k)

s = input().strip()
cc = Counter(s)
if(len(cc.keys())==k):
    print(cc.most_common()[-1][1]*k)
else:
    print(0)


f = open('test.txt')

input = f.readline

from collections import Counter

n, k = input().strip().split()
n, k = int(n), int(k)

s = input().strip()
cc = Counter(s)
if(len(cc.keys())==k):
    print(cc.most_common()[-1][1]*k)
else:
    print(0)


nk = map(int, raw_input().rstrip().split())
s = input()
n = nk[0]
k = nk[1]
dictl = {}
for i in s:
    if i in dictl:
        dictl[i] += 1
    else:
        dictl[i] = 1
m = min(dictl.values())
if k<len(dictl):
    return 0
else:
    return m*k


n = int(input("Enter n: "))
k = int(input("Enter k: "))
if k>26 or k<1 or n>10**5 or n<1:
    print("Enter valid numbers")
else:
    s = input("Enter the string")
    dictlet = {}
    for i in s:
        if i in dictlet:
            dictlet[i] += 1
        else:
            dictlet[i] = 1
    m = min(dictlet.values)
    print(m*k)


nk = input().split()
s = input()
n = nk[0]
k = int(nk[1])
dic = {}
for i in s:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
m = min(dic.values())
if len(dic)==k:
     result = m*k
else:
    result = 0
print(result)


n = 9
k = 3
s = ACAABCCAB
dictlet = {}
for i in s:
    if i in dictlet:
        dictlet[i] += 1
    else:
        dictlet[i] = 1
m = min(dictlet.values())
if len(dictlet)<k:
    print(0)
else:
    print(m*k)


from __future__ import print_function

import math
import os
import random
import re
import sys

def equality(n,k,word):
    dictlet = {}
    for i in word:
        if i in dictlet:
            dictlet{i} += 1
        else:
            dictlet{i} = 1
    m = min(dictlet.values())
    if k>len(dictlet):
        return 0
    else:
        return m*k

if __name__ == '__main__':
    f = open(os.environ['OUTPUT_PATH'], 'w')

    q = map(int, raw_input().rstrip().split())

    for q_itr in xrange(q):
        nk = raw_input().split()

        n = int(nk[0])

        k = int(nk[1])

    word = raw_input()


import math
import os
import random
import re
import sys

def equality(n,k,s):
    dictl = {}
    for i in s:
        if i in dictl:
            dictl[i] += 1
        else:
            dictl[i] = 1
    m = min(dictl.values())
    if k>len(dictl):
        return 0
    else:
        return m*k

if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')

    h = map(int, raw_input().rstrip().split())

    n = h[0]
    k = h[1]

    word = raw_input()

    result = designerPdfViewer(h, word)

    fptr.write(str(result) + '\n')

    fptr.close()


from __future__ import print_function

import math
import os
import random
import re
import sys

def equality(n,k,word):
    dictlet = {}
    for i in word:
        if i in dictlet:
            dictlet[i] += 1
        else:
            dictlet[i] = 1
    m = min(dictlet.values())
    if k>len(dictlet):
        return 0
    else:
        return m*k

if __name__ == '__main__':
    f = open(os.environ['OUTPUT_PATH'], 'w')

    q = map(int, raw_input().rstrip().split())

    for q_itr in xrange(q):
        nk = raw_input().split()

        n = int(nk[0])

        k = int(nk[1])

    word = raw_input()


n = int(input("Enter n: "))
k = int(input("Enter k: "))
if k>26 or k<1 or n>10**5 or n<1:
    print("Enter valid numbers")
    break
s = input("Enter the string")
dictlet = {}
for i in s:
    if i in dictlet:
        dictlet[i] += 1
    else:
        dictlet[i] = 1
m = min(dictlet.values)
print(m*k)


n = int(input())
k = int(input())
if k>26 or k<1 or n>10**5 or n<1:
    print("Enter valid numbers")
else:
    s = input("Enter the string")
    dictlet = {}
    for i in s:
        if i in dictlet:
            dictlet[i] += 1
        else:
            dictlet[i] = 1
    m = min(dictlet.values)
    print(m*k)


nk = map(int, raw_input().rstrip().split())
s = input()
n = nk[0]
k = nk[1]
dictl = {}
for i in s:
    if i in dictl:
        dictl[i] += 1
    else:
        dictl[i] = 1
m = min(dictl.values())
if k==len(dictl):
    return m*k
else:
    return 0


n, k = list(map(int, input().split()))
s = input()
dictl = {}
for i in s:
    if i in dictl:
        dictl[i] += 1
    else:
        dictl[i] = 1
m = min(dictl.values())
if k>len(len(dictl)):
    print("0")
else:
    print(m*k)


#	✪ H4WK3yE乡
#	Mayank Chaudhary
#	ABES EC , Ghaziabad
# ///==========Libraries, Constants and Functions=============///
import sys
from bisect import bisect_left,bisect_right
from collections import deque,Counter
from math import gcd,sqrt,factorial,ceil,log10
from itertools import permutations
inf = float("inf")
mod = 1000000007
mini=1000000007

def fact(n):                                                             # <------  To calculate factorial of n under modulo m
    if n==0:
        return 1
    p=1;d=(10**9)+7
    for i in range(1,n+1):
        p=p*i
        p=p%d
    return p

def ncr(n,r):                                                          # < ------ To calculate nCr mod p value using Fermat Little under modulo m
    d=10**9+7
    num=fact(n)
    den=(fact(r)*fact(n-r))%d
    den=pow(den,d-2,d)
    return (num*den)%d

def sieve(n):                                                          # <----- sieve of eratosthenes for prime no.
    prime=[True for i in range(n+1)]
    lst=[0]*(n+1)
    p=2
    while p*p<=n:
        if prime[p]:
            lst[p]=p
            for i in range(p*p,n+1,p):
                if prime[i]==True:
                    prime[i]=False
                    lst[i]=p
        p=p+1
    for i in range(1,n+1):
        if lst[i]==0:
            lst[i]=i
    mylist=[0]*(n+1)
    for i in range(2,n+1):
        mylist[lst[i]]=mylist[lst[i]]+1
    return mylist

def binary(number):                                             #  <----- calculate the no. of 1's in binary representation of number
    result=0
    while number:
        result=result+1
        number=number&(number-1)
    return result

def calculate_factors(n):                                #<---- most efficient method to calculate no. of factors of number
    hh = [1] * (n + 1);
    p = 2;
    while((p * p) < n):
        if (hh[p] == 1):
            for i in range((p * 2), n, p):
                hh[i] = 0;
        p += 1;
    total = 1;
    for p in range(2, n + 1):
        if (hh[p] == 1):
            count = 0;
            if (n % p == 0):
                while (n % p == 0):
                    n = int(n / p);
                    count += 1;
                total *= (count + 1);
    return total;

def prime_factors(n):                                         #<------------ to find prime factors of a no.
    i = 2
    factors = set()
    while i * i <= n:
        if n % i:
            i += 1
        else:
            factors.add(n//i)
            n=n//i
            factors.add(i)

    if n > 1:
        factors.add(n)
    return (factors)
def isPrime(n):                                                      #<-----------check whether a no. is prime or not
    if n==2 or n==3: return True
    if n%2==0 or n<2: return False
    for i in range(3,int(n**0.5)+1,2):   # only odd numbers
        if n%i==0:
            return False

    return True

def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
# ///==========MAIN=============///
n,k=get_ints()
string=input()
mydict=dict()
for i in range(65,92):
    mydict[chr(i)]=0
for i in string:
    mydict[i]=mydict.get(i,0)+1
#print(mydict)
mini=1000000000
for i in range(65,65+k):
    if mydict[chr(i)]<mini:
        mini=mydict[chr(i)]
print(mini*k)


#	✪ H4WK3yE乡
#	Mayank Chaudhary
#	ABES EC , Ghaziabad
# ///==========Libraries, Constants and Functions=============///
import sys
from bisect import bisect_left,bisect_right
from collections import deque,Counter
from math import gcd,sqrt,factorial,ceil,log10
from itertools import permutations
inf = float("inf")
mod = 1000000007
mini=1000000007

def fact(n):                                                             # <------  To calculate factorial of n under modulo m
    if n==0:
        return 1
    p=1;d=(10**9)+7
    for i in range(1,n+1):
        p=p*i
        p=p%d
    return p

def ncr(n,r):                                                          # < ------ To calculate nCr mod p value using Fermat Little under modulo m
    d=10**9+7
    num=fact(n)
    den=(fact(r)*fact(n-r))%d
    den=pow(den,d-2,d)
    return (num*den)%d

def sieve(n):                                                          # <----- sieve of eratosthenes for prime no.
    prime=[True for i in range(n+1)]
    lst=[0]*(n+1)
    p=2
    while p*p<=n:
        if prime[p]:
            lst[p]=p
            for i in range(p*p,n+1,p):
                if prime[i]==True:
                    prime[i]=False
                    lst[i]=p
        p=p+1
    for i in range(1,n+1):
        if lst[i]==0:
            lst[i]=i
    mylist=[0]*(n+1)
    for i in range(2,n+1):
        mylist[lst[i]]=mylist[lst[i]]+1
    return mylist

def binary(number):                                             #  <----- calculate the no. of 1's in binary representation of number
    result=0
    while number:
        result=result+1
        number=number&(number-1)
    return result

def calculate_factors(n):                                #<---- most efficient method to calculate no. of factors of number
    hh = [1] * (n + 1);
    p = 2;
    while((p * p) < n):
        if (hh[p] == 1):
            for i in range((p * 2), n, p):
                hh[i] = 0;
        p += 1;
    total = 1;
    for p in range(2, n + 1):
        if (hh[p] == 1):
            count = 0;
            if (n % p == 0):
                while (n % p == 0):
                    n = int(n / p);
                    count += 1;
                total *= (count + 1);
    return total;

def prime_factors(n):                                         #<------------ to find prime factors of a no.
    i = 2
    factors = set()
    while i * i <= n:
        if n % i:
            i += 1
        else:
            factors.add(n//i)
            n=n//i
            factors.add(i)

    if n > 1:
        factors.add(n)
    return (factors)
def isPrime(n):                                                      #<-----------check whether a no. is prime or not
    if n==2 or n==3: return True
    if n%2==0 or n<2: return False
    for i in range(3,int(n**0.5)+1,2):   # only odd numbers
        if n%i==0:
            return False

    return True

def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()
# ///==========MAIN=============///
n,k=get_ints()
string=input()
mydict=dict()
for i in range(65,92):
    mydict[chr(i)]=0
for i in string:
    mydict[i]=mydict.get(i,0)+1
#print(mydict)
mini=1000000000
for i in range(65,65+k):
    if mydict[chr(i)]<mini:
        mini=mydict[chr(i)]
print(mini)


n=int(input())
k=int(input())
s=input()
a=[0 for i in range(0,91)]
dem=0
for i in s:
    x=int(ord(i))
    a[x]+=1

min=0
for i in range(65,91):
    if a[i]>0:
        dem+=1
        if dem==1:
            min=a[i]
        elif a[i]<min:
            min=a[i]

if dem==k:
    print(min*k)
else: print(0)


n,k=map(int, input().split())
s=input()
a=[0 for i in range(0,91)]
dem=0
for i in s:
    x=int(ord(i))
    a[x]+=1

min=0
for i in range(65,91):
    if a[i]>0:
        dem+=1
        if dem==1:
            min=a[i]
        elif a[i]<min:
            min=a[i]

if dem==k:
    print(min*k)
else: print(0)


n,k = map(int,input().split())
s = input()
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
min = 9999999999999
for i in range(1,k+1):
	k = s.count(alpha[i])
	if k <= min:
		min = k
print(min * k)


n,k = map(int,input().split())
s = input()
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
min = 9999999999999
for i in range(1,k+1):
	k = s.count(alpha[i-1])
	if k <= min:
		min = k
print(min * k)


n, k = map(int, input().split())
s = input()

print(k * min(s.count(chr(t)) for t in range(ord('A'), ord('A') + k)))


n, k = list(map(int, input().split()))
s = input()
d = {}
for c in s:
    d[c] = d.get(c,0) + 1
m = 10**9
for i in range(k):
    letter = chr(ord('A')+i)
    occurance = 0
    if letter in d:
        occurance = d[letter]
    m = min(m,occurance)
print(m*k)


n = int(input())
k = int(input())
s = input()
d = {}
for c in s:
    d[c] = d.get(c,0) + 1
m = 10**9
for i in range(k):
    letter = chr(ord('A')+i)
    occurance = 0
    if letter in d:
        occurance = d[letter]
    m = min(m,occurance)
print(m*k)


inn = input()
n, k = inn.split()
n, k = int(n), int(k)
lett = []
for i in range(26):
    lett.append(0)
s = input()
for i in range(n):
    lett[ord(s[i])-ord('A')]+=1
menor = lett[0]
for i in range(k):
    menor = min(menor, lett[i])
print(menor*k)


inn = input()
n, k = inn.split()
n, k = int(n), int(k)
lett = []
for i in range(26):
    lett.append(0)
s = input()
for i in range(n):
    lett[ord(s[i])-ord('A')]+=1
menor = lett[0]
for i in range(k):
    menor = min(menor, lett[i])
print(menor)


mp={}
for i in range(65,91):
    mp[i]=0

n,m= map(int, input().split())
s=input()

idx=-1
for i in range(n):
    mp[ord(s[i])]+=1
    cnt=mp[65]
    for j in range(66,65+m):
        cnt=min(cnt,mp[j])
print(cnt*m)


mp={}
for i in range(65,91):
    mp[i]=0

n,m= map(int, input().split())
s=input()

idx=-1
for i in range(n):
    mp[ord(s[i])]+=1
    cnt=mp[65]
    for j in range(66,65+m):
        cnt=min(cnt,mp[j])

if(cnt==0):
    print(0)
else:
    print(cnt*m,'th',sep='')


n, k = map(int, input().split())
s = input()

count = {}
for c in 'ABCDEFGHIKLMNOPQRSTVXYZ '[:k]:
    count[c] = 0

for c in s:
    count[c] += 1

print(count[min(count, key=count.get)] * k)


import sys

n, k = map(int, input().split())

count = {}
for c in 'ABCDEFGHIKLMNOPQRSTVXYZ '[:k]:
    count[c] = 0

for i in range(n):
    ch = sys.stdin.read(1)
    if ch in count:
        count[ch] += 1

print(count[min(count, key=count.get)] * k)


import sys

n, k = map(int, input().split())

count = {}
for c in 'ABCDEFGHIKLMNOPQRSTVXYZ '[:k]:
    count[c] = 0

for i in range(n):
    ch = sys.stdin.read(1)
    count[ch] += 1

print(count[min(count, key=count.get)] * k)


import sys

n, k = map(int, input().split())

count = {}
for c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ '[:k]:
    count[c] = 0

for i in range(n):
    ch = sys.stdin.read(1)
    if ch in count:
        count[ch] += 1

print(count[min(count, key=count.get)] * k)


n,k=map(int,input().split())
s=input()
p=[0]*k
t='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
b=t[:k]
for i in s:
    if i in b:
        p[ord(i)-65]+=1
print(min(p)*k)


n,k=map(int,input().split())
s=input()
p=[0]*k
t='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
b=t[:k]
for i in s:
    if i in b:
        p[ord(i)-65]+=1
print(min(p))


n,k=map(int,input().split())
s=input()
cnt=[0]*k
for i in range(len(s)):
    cnt[ord(s[i])-ord('A')]+=1
res=1000000
for i in range(k):
    res=min(res,cnt[i])
print(k*res)


n,k=map(int,input().split())
s=input()
cnt=[0]*k
for i in range(len(s)):
    cnt[ord(s[i])-ord('A')]+=1
res=1000000
for i in range(k):
    res=min(res,cnt[i])
print(res)


string = input().split(' ')

n = int(string[0])
k = int(string[1])

string = input()

chars = []

for i in range(k):
  chars.append(str(chr(65+i)))

minimum = float("inf")

for item in chars:
  num = string.count(item)
  if num < minimum:
    minimum = num

print(str(minimum*k))


def countString (string, k):
  unique = set(list(string))
  if len(unique) != k:
    return False
  num = []
  for item in unique:
    num.append(string.count(item))
  return len(set(num)) == 1

string = input().split(' ')

n = int(string[0])
k = int(string[1])

string = input()

currentMax = 0

for i in range(n):
    for j in range(n, -1, -1):
      if countString(string[i:j+1], k):
        if (j-i) > currentMax:
          currentMax = j-i

print(currentMax)


n,k=map(int,inout().split())
s=input()
print(k*min(s.count(chr(65+i))for i in range(k)))


n, k = map(int, input().split())
s = input()
print(k*min(s.count(chr(65+i))for i in range(k)))


from collections import Counter

n, k = map(int, input().split())

s = input()

d = Counter(s)

if len(d.keys()) != k:
    print(0)
else:
    print(min(d.values())*k)


n, k = map(int, input().split())
s = list(input())
count = 100000
for i in set(s):
    if s.count(i) < count:
        count = s.count(i)
print(0 if len(set(s)) < k else k*count)

# HaPpY NoWrUz 1398
# UBCF
# CodeForcesian


n, k = map(int, input().split())
s = list(input())
s.append("$")
if len(set(s))-1 < k:
    print(0)
    exit()
c = 0
d = len(set(s)) - 1
i = 0
while True:
    if s[i] == '$':
        break
    if s[i] == s[i+1]:
        del s[i]
        del s[i+1]
        # s.remove(i)
        # s.remove(i+1)
    i += 1
print(len(s))

# HaPpY NoWrUz 1398
# UBCF
# CodeForcesian


n, k = map(int, input().split())
s = list(input())
count = 100000
for i in s:
    if s.count(i) < count:
        count = s.count(i)
print(0 if len(set(s)) < k else k*count)

# HaPpY NoWrUz 1398
# UBCF
# CodeForcesian


n, k = map(int, input().split())
s = list(input())
s.append("$")
if len(set(s))-1 < k:
    print(0)
    exit()
c = 0
d = len(set(s)) - 1
i = 0
while True:
    if s[i] == '$':
        break
    if s[i] == s[i+1]:
        i += 2
        continue
    else:
        if ord(s[i]) < ord(s[i+1]):
            c += 2
    i += 1
# print(len(s))
print(c)

# HaPpY NoWrUz 1398
# UBCF
# CodeForcesian


n, k = map(int, input().split())
s = list(input())
if len(set(s)) < k:
    print(0)
    exit()
c = 0
j = 0
while True:
    if j >= len(s) - 1:
        break
    if ord(s[j]) == ord(s[j + 1]):
        j += 2
        # continue
    if ord(s[j]) < ord(s[j + 1]):
        c += 2
        j += 2
    j += 1
print(c)

# HaPpY NoWrUz 1398
# UBCF
# CodeForcesian


n, k = map(int, input().split())
s = list(input())
a = [s.count(chr(i + 65)) for i in range(k)]
print(min(a) * k)


n, k = map(int, input().split())
s = list(input())
for i in s:
    if ord(i) - 65 >= k:
        s.remove(i)
a = [s.count(chr(i + 65)) for i in range(k)]
print(min(a) * k)


s = input().split()
n, k = int(s[0]), int(s[1])
s = input()
mn = n
count = 0
for i in range(k):
  t = s.count(chr(65+i))
  count+=t
  if t<mn:
    mn = t

if t!=0:
  print(mn*t+n-count)
else:
  print(0)


s = input().split()
n, k = int(s[0]), int(s[1])
s = input()
mn = n
count = 0
for i in range(k):
  t = s.count(chr(65+i))
  count+=t
  if t<mn:
    mn = t

if mn!=0:
  print(mn*k+n-count)
else:
  print(0)


para = list(map(int, input().split()))
n = int(para[0])
k = int(para[1])
s = input()
track = [0] * k

def even(track):
    for i in range(len(track) - 1):
        if track[i] != track[i + 1]:
            return False
    return True

for i in s:
    track[ord(i) - 65] += 1
track = sorted(track)
#if even(track):
#    print((track[0] - 1) * len(track))
#else:
print(track[0] * len(track))


para = list(map(int, input().split()))
n = int(para[0])
k = int(para[1])
s = input()
track = [0] * k

def even(track):
    for i in range(len(track)):
        if track[i] != track[i + 1]:
            return False
    return True

for i in s:
    track[ord(i) - 65] += 1
track = sorted(track)
if len(track) == 1 or even(track):
    print(0)
else:
    print(track[0] * len(track))


para = list(map(int, input().split()))
n = int(para[0])
k = int(para[1])
s = input()
track = [0] * k

def even(track):
    for i in range(len(track) - 1):
        if track[i] != track[i + 1]:
            return False
    return True

for i in s:
    track[ord(i) - 65] += 1
track = sorted(track)
if even(track):
    print((track[0] - 1) * len(track))
else:
    print(track[0] * len(track))


n, k = map(int, input().split())
s = input()
print(k * min(s.count(c) for c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[:k]))


from collections import Counter

_, k = map(int, input().split())
c = Counter(input())

print(0 if len(c) < k else k * min(c.values()))


import sys

N, K = map(int, sys.stdin.readline().strip().split())
string = sys.stdin.readline().strip()

from collections import defaultdict
appearance = defaultdict(int)

for ch in string:
    appearance[ch] += 1

min = 1e9
for key, val in appearance.items():
    if min > val:
        min = val
if len(appearance) < K:
    print(0)
else:
    print(min * len(appearance))


import sys

N, K = map(int, sys.stdin.readline().strip().split())
string = sys.stdin.readline().strip()

from collections import defaultdict
appearance = defaultdict(int)

for ch in string:
    appearance[ch] += 1

min = 1e9
for key, val in appearance.items():
    if min > val:
        min = val

print(min * len(appearance))


n,k = map(int,input().split(" "))
ip=input()
seq ={}
i=0
while i<n:
	if ord(ip[i])<(65+k):
		if ip[i] in seq:
			seq[ip[i]]+=1
		else:
			seq[ip[i]]=1
	i+=1
vallist =  sorted(seq.items(), key=lambda x: x[1])
length = len(seq)
if length == k:
		print(vallist[0][1]*k)
else:
	print(0)


n,k = map(int,input().split(" "))
ip=input()
seq ={}
i=0
while i<n:
	if ord(ip[i])<(65+k):
		if ip[i] in seq:
			seq[ip[i]]+=1
		else:
			seq[ip[i]]=1
	i+=1
vallist1 = sorted(seq.items(), key=lambda x: x[0])
vallist2 =  sorted(seq.items(), key=lambda x: x[1])
if ord(vallist1[-1][0]) == 65+k-1:
		print(vallist2[0][1]*k)
else:
	print(0)


n,k = map(int,input().split(" "))
ip=input()
seq ={}
i=0
while i<n:
	if ord(ip[i])<(65+k):
		if ip[i] in seq:
			seq[ip[i]]+=1
		else:
			seq[ip[i]]=1
	i+=1
vallist1 = sorted(seq.items(), key=lambda x: x[0])
vallist2 =  sorted(seq.items(), key=lambda x: x[1])
length = len(seq)
if length == k:
		print(vallist2[0][1]*k)
else:
	print(0)


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#define ll long long
using namespace std;
const int N=1e6+10,B=5000,C=N/B+10;
const double pi=acos(-1);
struct cmplx{/*{{{*/
    double a,b;
    cmplx(){}
    cmplx(double a1,double b1){a=a1; b=b1;}
    void init(){a=b=0;}
    friend cmplx operator + (cmplx x,cmplx y)
    {return cmplx(x.a+y.a,x.b+y.b);}
    friend cmplx operator - (cmplx x,cmplx y)
    {return cmplx(x.a-y.a,x.b-y.b);}
    friend cmplx operator * (cmplx x,cmplx y)
    {return cmplx(x.a*y.a-x.b*y.b,x.a*y.b+x.b*y.a);}
};/*}}}*/
namespace FFT{/*{{{*/
    const int TOP=20,N=(1<<18)+10;
    cmplx A[N],B[N];
    int rev[N],vis[TOP+1];
    int len;
    void get_len(int n){
        for (int i=0;i<len;++i) A[i].init(),B[i].init();
        int bit=0;
        for (len=1;len<=n;++bit,len<<=1);
        rev[0]=0;
        for (int i=1;i<len;++i) rev[i]=(rev[i>>1]>>1)|((i&1)<<(bit-1));
    }
    void clr(int op){
        for (int i=0;i<len;++i) if (op) B[i].init();else A[i].init();
    }
    void fft(cmplx *a,int op){
        for (int i=0;i<len;++i)
            if (rev[i]>i) swap(a[rev[i]],a[i]);
        cmplx w,u,v,w_n;
        for (int step=2,k=0;step<=len;step<<=1,++k){
            w_n=cmplx(cos(2*pi/step),op*sin(2*pi/step));
            for (int st=0;st<len;st+=step){
                w=cmplx(1,0);
                for (int i=0;i<(step>>1);++i){
                    //w=W[k][i]; w.b*=op;
                    v=a[st+i+(step>>1)]*w;
                    u=a[st+i];
                    a[st+i]=u+v;
                    a[st+i+(step>>1)]=u-v;
                    w=w*w_n;
                }
            }
        }
        if (op==1) return;
        for (int i=0;i<len;++i) a[i].a/=len;
    }
}/*}}}*/
char a[N],b[N];
ll dis[C][N];
int n,m,sq,q,numa,numb;
ll get_val(cmplx x){return 1LL*round(x.a);}
int Id(int x){return (x-1)/sq+1;}
int St(int x){return (x-1)*sq+1;}
int Ed(int x){return x*sq;}
void prework(){
    sq=B;

    int l,r,len;
    numa=Id(n);
    numb=Id(m);
    FFT::get_len(B+m);

    for (int i=1;i<=m;++i) FFT::B[i]=cmplx(b[i]=='1'?1:-1,0);
    FFT::fft(FFT::B,1);
    for (int i=1;i<=numa;++i){
        l=St(i); r=min(Ed(i),n);
        FFT::clr(0);
        for (int j=r;j>=l;--j) FFT::A[r-j+1]=cmplx(a[j]=='1'?1:-1,0);
        FFT::fft(FFT::A,1);
        for (int j=0;j<FFT::len;++j) FFT::A[j]=FFT::A[j]*FFT::B[j];
        FFT::fft(FFT::A,-1);
        len=r-l+1;
        for (int j=1;j<=m;++j)
            dis[i][j]=(len-get_val(FFT::A[j+len]))/2;
    }
}
int query(int p1,int p2,int len){
    int ret=0;
    int num1=Id(p1),num2=Id(p1+len-1);
    if (num1==num2){
        for (int i=0;i<len;++i)
            ret+=a[p1+i]!=b[p2+i];
    }
    else{
        for (int i=p1;i<=Ed(num1);++i)
            ret+=a[i]!=b[p2+i-p1];
        for (int i=num1+1;i<num2;++i)
            ret+=dis[i][p2+St(i)-p1];
        for (int i=St(num2);i<=p1+len-1;++i)
            ret+=a[i]!=b[p2+i-p1];
    }
    return ret;
}

int main() {
    int p1,p2,len;
    scanf("%s",a+1);
    scanf("%s",b+1);
    n=strlen(a+1); m=strlen(b+1);
    prework();
	int ans = 0;
	for (int i=0; i<=n-m; ++i) {
		p1=i,p2=0,len=m;
        ++p1; ++p2;
        ans += query(p1,p2,len)%2==0;
    }
	printf("%d\n", ans);
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)

using namespace std;

bool rev(pair<ll,ll> x,pair<ll,ll> y)
{
    return x.first>y.first;
}
ll countOnes (ll n)
{
ll count=0;
while (n!=0)
{
n = n & (n-1);
count++;
}
return count;
}
ll convertBinaryToDecimal(ll n)
{
    ll decimalNumber = 0, i = 0, remainder;
    while (n!=0)
    {
        remainder = n%10;
        n /= 10;
        decimalNumber += remainder*pow(2,i);
        ++i;
    }
    return decimalNumber;
}

int main() {

string a,b;
cin>>a>>b;
ll bx=stoll(b);
    ll bn=convertBinaryToDecimal(bx);
    string s22=a.substr(0,b.size());
        ll s2=stoll(s22);
        ll s2n=convertBinaryToDecimal(s2);
       // cout<<s2n<<endl;

    ll ans=0;
    if(__builtin_popcount (bn^s2n)%2==0)ans++;;
    for(ll i=1;i+b.size()<=a.size();i++)
    {   string s22=a.substr(0,b.size());
        if(a[i-1]-'0')s2n-=pow(2,b.size()-1);
        s2n*=2;
        if(s22[b.size()-1]-'0')s2n++;
        //cout<<s2n<<endl;
        if(__builtin_popcount (bn^s2n)%2==0)ans++;
    }

	cout<<ans;

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)

using namespace std;

bool rev(pair<ll,ll> x,pair<ll,ll> y)
{
    return x.first>y.first;
}
ll countOnes (ll n)
{
ll count=0;
while (n!=0)
{
n = n & (n-1);
count++;
}
return count;
}
ll convertBinaryToDecimal(ll n)
{
    ll decimalNumber = 0, i = 0, remainder;
    while (n!=0)
    {
        remainder = n%10;
        n /= 10;
        decimalNumber += remainder*pow(2,i);
        ++i;
    }
    return decimalNumber;
}

int main() {

string a,b;
cin>>a>>b;
ll bx=stoll(b);
    ll bn=convertBinaryToDecimal(bx);
    string s22=a.substr(0,b.size());
        ll s2=stoll(s22);
        ll s2n=convertBinaryToDecimal(s2);
        //cout<<s2n<<endl;

    ll ans=0;
    if(__builtin_popcount (bn^s2n)%2==0)ans++;;
    for(ll i=1;i+b.size()<=a.size();i++)
    {   string s22=a.substr(0,b.size());
        if(a[i-1])s2n-=pow(2,b.size()-1);
        s2n*=2;
        if(s22[b.size()-1])s2n++;
        //cout<<s2n<<endl;
        if(__builtin_popcount (bn^s2n)%2==0)ans++;
    }

	cout<<ans;

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)

using namespace std;

bool rev(pair<ll,ll> x,pair<ll,ll> y)
{
    return x.first>y.first;
}
ll countOnes (ll n)
{
ll count=0;
while (n!=0)
{
n = n & (n-1);
count++;
}
return count;
}
ll convertBinaryToDecimal(ll n)
{
    ll decimalNumber = 0, i = 0, remainder;
    while (n!=0)
    {
        remainder = n%10;
        n /= 10;
        decimalNumber += remainder*pow(2,i);
        ++i;
    }
    return decimalNumber;
}

int main() {

string a,b;
cin>>a>>b;
ll bx=stoll(b);
    ll bn=convertBinaryToDecimal(bx);
    //cout<<bn;
    ll ans=0;
    for(ll i=0;i+b.size()<=a.size();i++)
    {   //cout<<i<<" "<<i+b.size()-1;
        string s22=a.substr(i,b.size());
        //cout<<s2<<endl;
        ll s2=stoll(s22);
        ll s2n=convertBinaryToDecimal(s2);
        if(__builtin_popcount (bn^s2n)%2==0)ans++;;
    }

	cout<<ans;

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)

using namespace std;

bool rev(pair<ll,ll> x,pair<ll,ll> y)
{
    return x.first>y.first;
}

ll convertBinaryToDecimal(ll n)
{
    ll decimalNumber = 0, i = 0, remainder;
    while (n!=0)
    {
        remainder = n%10;
        n /= 10;
        decimalNumber += remainder*pow(2,i);
        ++i;
    }
    return decimalNumber;
}

ll power(ll x, ll y)

{

if (y == 0)

return 1;

else if (y%2 == 0)

return power(x*x, y/2);

else

return x*power(x*x, y/2);

}

int main() {

string a,b;
cin>>a>>b;
ll bx=stoll(b);
    ll bn=convertBinaryToDecimal(bx);
    string s22=a.substr(0,b.size());
        ll s2=stoll(s22);
        ll s2n=convertBinaryToDecimal(s2);
        //cout<<s2n<<endl;
   ll u=power(2,b.size()-1);
    ll ans=0;
    if(__builtin_popcount (bn^s2n)%2==0)ans++;;
    for(ll i=1;i+b.size()<=a.size();i++)
    {   //string s22=a.substr(i,b.size());
        if(a[i-1]-'0'==1)s2n-=u;
        s2n*=2;
        if(a[i+b.size()-1]-'0'==1)s2n++;
       // cout<<s2n<<endl;
        if(__builtin_popcount (bn^s2n)%2==0)ans++;
    }

	cout<<ans;

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)

using namespace std;

bool rev(pair<ll,ll> x,pair<ll,ll> y)
{
    return x.first>y.first;
}
ll countOnes (ll n)
{
ll count=0;
while (n!=0)
{
n = n & (n-1);
count++;
}
return count;
}
ll convertBinaryToDecimal(ll n)
{
    ll decimalNumber = 0, i = 0, remainder;
    while (n!=0)
    {
        remainder = n%10;
        n /= 10;
        decimalNumber += remainder*pow(2,i);
        ++i;
    }
    return decimalNumber;
}

int main() {

string a,b;
cin>>a>>b;
ll bx=stoll(b);
    ll bn=convertBinaryToDecimal(bx);
    string s22=a.substr(0,b.size());
        ll s2=stoll(s22);
        ll s2n=convertBinaryToDecimal(s2);
        //cout<<s2n<<endl;

    ll ans=0;
    if(__builtin_popcount (bn^s2n)%2==0)ans++;;
    for(ll i=1;i+b.size()<=a.size();i++)
    {   string s22=a.substr(i,b.size());
        if(a[i-1]-'0'==1)s2n-=pow(2,b.size()-1);
        s2n*=2;
        if(s22[b.size()-1]-'0'==1)s2n++;
       // cout<<s2n<<endl;
        if(__builtin_popcount (bn^s2n)%2==0)ans++;
    }

	cout<<ans;

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)

using namespace std;

bool rev(pair<ll,ll> x,pair<ll,ll> y)
{
    return x.first>y.first;
}
ll countOnes (ll n)
{
ll count=0;
while (n!=0)
{
n = n & (n-1);
count++;
}
return count;
}
ll convertBinaryToDecimal(ll n)
{
    ll decimalNumber = 0, i = 0, remainder;
    while (n!=0)
    {
        remainder = n%10;
        n /= 10;
        decimalNumber += remainder*pow(2,i);
        ++i;
    }
    return decimalNumber;
}

int main() {

string a,b;
cin>>a>>b;
ll bx=stoll(b);
    ll bn=convertBinaryToDecimal(bx);
    string s22=a.substr(0,b.size());
        ll s2=stoll(s22);
        ll s2n=convertBinaryToDecimal(s2);
        //cout<<s2n<<endl;
   ll u=pow(2,b.size()-1);
    ll ans=0;
    if(__builtin_popcount (bn^s2n)%2==0)ans++;;
    for(ll i=1;i+b.size()<=a.size();i++)
    {   string s22=a.substr(i,b.size());
        if(a[i-1]-'0'==1)s2n-=u;
        s2n*=2;
        if(s22[b.size()-1]-'0'==1)s2n++;
       // cout<<s2n<<endl;
        if(__builtin_popcount (bn^s2n)%2==0)ans++;
    }

	cout<<ans;

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)

using namespace std;

bool rev(pair<ll,ll> x,pair<ll,ll> y)
{
    return x.first>y.first;
}
ll countOnes (ll n)
{
ll count=0;
while (n!=0)
{
n = n & (n-1);
count++;
}
return count;
}
ll convertBinaryToDecimal(ll n)
{
    ll decimalNumber = 0, i = 0, remainder;
    while (n!=0)
    {
        remainder = n%10;
        n /= 10;
        decimalNumber += remainder*pow(2,i);
        ++i;
    }
    return decimalNumber;
}

int main() {

string a,b;
cin>>a>>b;
ll bx=stoll(b);
    ll bn=convertBinaryToDecimal(bx);
    //cout<<bn;
    ll ans=0;
    for(ll i=0;i+b.size()<=a.size();i++)
    {   //cout<<i<<" "<<i+b.size()-1;
        string s22=a.substr(i,b.size());
        //cout<<s2<<endl;
        ll s2=stoll(s22);
        ll s2n=convertBinaryToDecimal(s2);
        if(countOnes(bn^s2n)%2==0)ans++;;
    }

	cout<<ans;

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)

using namespace std;

bool rev(pair<ll,ll> x,pair<ll,ll> y)
{
    return x.first>y.first;
}
ll countOnes (ll n)
{
ll count=0;
while (n!=0)
{
n = n & (n-1);
count++;
}
return count;
}
ll convertBinaryToDecimal(ll n)
{
    ll decimalNumber = 0, i = 0, remainder;
    while (n!=0)
    {
        remainder = n%10;
        n /= 10;
        decimalNumber += remainder*pow(2,i);
        ++i;
    }
    return decimalNumber;
}

ll power(ll x, ll y)

{

if (y == 0)

return 1;

else if (y%2 == 0)

return power(x, y/2)*power(x, y/2);

else

return x*power(x, y/2)*power(x, y/2);

}

int main() {

string a,b;
cin>>a>>b;
ll bx=stoll(b);
    ll bn=convertBinaryToDecimal(bx);
    string s22=a.substr(0,b.size());
        ll s2=stoll(s22);
        ll s2n=convertBinaryToDecimal(s2);
        //cout<<s2n<<endl;
   ll u=power(2,b.size()-1);
    ll ans=0;
    if(__builtin_popcount (bn^s2n)%2==0)ans++;;
    for(ll i=1;i+b.size()<=a.size();i++)
    {   //string s22=a.substr(i,b.size());
        if(a[i-1]-'0'==1)s2n-=u;
        s2n*=2;
        if(a[i+b.size()-1]-'0'==1)s2n++;
       // cout<<s2n<<endl;
        if(__builtin_popcount (bn^s2n)%2==0)ans++;
    }

	cout<<ans;

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)

using namespace std;

bool rev(pair<ll,ll> x,pair<ll,ll> y)
{
    return x.first>y.first;
}
ll power(ll x, ll y)

{

if (y == 0)

return 1;

else if (y%2 == 0)

return power(x*x, y/2);

else

return x*power(x*x, y/2);

}
ll convertBinaryToDecimal(ll n)
{
    ll decimalNumber = 0, i = 0, remainder;
    while (n!=0)
    {
        remainder = n%10;
        n /= 10;
        decimalNumber += remainder*power(2,i);
        ++i;
    }
    return decimalNumber;
}

int main() {

string a,b;
cin>>a>>b;
ll bx=stoll(b);
    ll bn=convertBinaryToDecimal(bx);
    string s22=a.substr(0,b.size());
        ll s2=stoll(s22);
        ll s2n=convertBinaryToDecimal(s2);
        //cout<<s2n<<endl;
   ll u=power(2,b.size()-1);
    ll ans=0;
    if(__builtin_popcount (bn^s2n)%2==0)ans++;;
    for(ll i=1;i+b.size()<=a.size();i++)
    {   //string s22=a.substr(i,b.size());
        if(a[i-1]-'0'==1)s2n-=u;
        s2n*=2;
        if(a[i+b.size()-1]-'0'==1)s2n++;
       // cout<<s2n<<endl;
        if(__builtin_popcount (bn^s2n)%2==0)ans++;
    }

	cout<<ans;

}


#include <iostream>
#define ll long long
using namespace std;

int main() {
	string a,b;
	cin>>a>>b;
	ll len_b=b.size(),ones=0;

	for(char x:b)ones+=(x=='1');
	ones%=2;
	ll pre[a.size()];
	pre[0]=(a[0]=='1');
	for(ll i=1;i<a.size();i++)
	{
	    pre[i]=pre[i-1]+(a[i]=='1');
	}
	ll ans=0;
	if(pre[len_b-1]%2==ones)ans++;
	for(ll i=len_b;i<a.size();i++)
	{
	    if((pre[i]-pre[i-len_b])%2==ones)ans++;
	}
    cout<<ans;

}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)

using namespace std;

bool rev(pair<ll,ll> x,pair<ll,ll> y)
{
    return x.first>y.first;
}

int main() {

string a,b;
cin>>a>>b;

    ll ans=0;
    string s22=a.substr(0,b.size());

    ll c=0;
    for(ll i=0;i<b.size();i++)
    {   //cout<<s22[i]<<" "<<b[i]<<endl;
        if(s22[i]!=b[i])c++;
    }
    //cout<<c;
   if(c%2==0)ans++;
   ll cc=c;
    for(ll i=1;i+b.size()<=a.size();i++)
    {
        if(b[0]-'0'!=a[i-1]-'0')cc--;
        if(b[0]-'0'!=a[i]-'0')cc++;
        if(b[-1+b.size()]-'0'!=a[i-2+b.size()]-'0')cc--;
        if(b[-1+b.size()]!=a[i-1+b.size()])cc++;
        if(cc%2==0)ans++;

    }

	cout<<ans;

}


#include <bits/stdc++.h>

using namespace std;

int main(){
	string a,b;
	cin >> a >> b;
	int l = b.length();
	int tmp = 0;
	int ans = a.length() - l + 1;
	for(int i = 0 ; i < l ; i++){
		tmp ^= a[i] ^ b[i];
	}
	ans -= tmp;
	for(int i = l ; i < a.length() ; i++){
		tmp ^= a[i-l] ^ a[i];
		ans -= tmp;
	}
	cout << ans << "\n";
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int dif(string a,string b){
	int cnt = 0;
	for(int i = 0 ; i < a.length() ; i++){
		if(a[i] ^ b[i])
			cnt++;
	}
	return cnt;
}

int main(){
	string a,b;
	cin >> a >> b;
	int l = b.length();
	int cnt = 0;
	for(int i = 0 ; i <= a.length() - b.length() ; i++){
		if(dif(a.substr(i,l),b) % 2 == 0)
			cnt++;
	}
	cout << cnt << "\n";
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int dif(string a,string b){
	int cnt = 0;
	for(int i = 0 ; i < a.length() ; i++){
		if(a[i]-'0' ^ b[i]-'0')
			cnt++;
	}
	return cnt;
}

int main(){
	string a,b;
	cin >> a >> b;
	int l = b.length();
	int cnt = 0;
	for(int i = 0 ; i <= a.length() - b.length() ; i++){
		if(dif(a.substr(i,l),b) % 2 == 0)
			cnt++;
	}
	cout << cnt << "\n";
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int dif(string a,string b){
	int cnt = 0;
	for(int i = 0 ; i < a.length() ; i++){
		if(a[i]-'0' ^ b[i]-'0')
			cnt++;
	}
	return cnt;
}

int main(){
	string a,b;
	cin >> a >> b;
	int l = b.length();
	int cnt = 0;
	for(int i = 0 ; i < a.length() - b.length() ; i++){
		if(dif(a.substr(i,l),b) % 2 == 0)
			cnt++;
	}
	cout << cnt << "\n";
	return 0;
}


// Author : MohamedSameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define IN(n) scanf("%d" , &n )
#define debug(x) cout<<#x<<" = { "<<x<<" }\n"
void fo (){fflush(stdout);}
using namespace std;
string a , b ;
int pre[1000009];
int main ()
{
int ans = 0 ;
cin >> a >> b ;
pre[0] = a[0] == '1';
int ones= 0 ;
for (int i =1 ; i < SZ(a) ; i++)
{
  pre[i] = pre[i-1] + (a[i] == '1');
}
for (int i =0 ; i < SZ(b) ;i++)ones += b[i] == '1';
for (int i =-1 , j = SZ(b)-1 ; j < SZ(a) ;i++,j++)
{
  int tem = pre[j] - (i>=0 ? pre[i] : 0 );
  if ( tem%2 == ones %2  )ans++;
}
printf ("%d\n" ,ans );
  cerr << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}


// Author : MohamedSameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define IN(n) scanf("%d" , &n )
#define debug(x) cout<<#x<<" = { "<<x<<" }\n"
void fo (){fflush(stdout);}
using namespace std;
string a , b ;
int pre[1000009];
int main ()
{
int ans ;
cin >> a >> b ;
pre[0] = a[0] == '1';
int ones= 0 ;
for (int i =1 ; i < SZ(a) ; i++)
{
  pre[i] += pre[i-1] + a[i] == '1';
}
for (int i =0 ; i < SZ(b) ;i++)ones += b[i] == '1';
for (int i =-1 , j = SZ(b)-1 ; j < SZ(a) ;i++,j++)
{
  int tem = pre[j] - (i>=0 ? pre[i] : 0 );
  if ( tem%2 == ones %2  )ans++;
}
printf ("%d\n" ,ans );
  cerr << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}


// Author : MohamedSameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define IN(n) scanf("%d" , &n )
#define debug(x) cout<<#x<<" = { "<<x<<" }\n"
void fo (){fflush(stdout);}
using namespace std;
string a , b ;
int pre[1000001];
int main ()
{
int ans ;
cin >> a >> b ;
pre[0] = a[0] == '1';
int ones= 0 ;
for (int i =1 ; i < SZ(a) ; i++)
{
  pre[i] += pre[i-1] + a[i] == '1';
}
for (int i =0 ; i < SZ(b) ;i++)ones += b[i] == '1';
for (int i =-1 , j = SZ(b)-1 ; j < SZ(a) ;i++,j++)
{
  int tem = pre[j] - (i>=0 ? pre[i] : 0 );
  if ( tem%2 == ones %2  )ans++;
}
printf ("%d\n" ,ans );
  cerr << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}


// Author : MohamedSameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define IN(n) scanf("%d" , &n )
#define debug(x) cout<<#x<<" = { "<<x<<" }\n"
void fo (){fflush(stdout);}
using namespace std;
string a , b ;
int pre[1000009];
int main ()
{
int ans = 0 ;
cin >> a >> b ;
pre[0] = a[0] == '1';
int ones= 0 ;
for (int i =1 ; i < SZ(a) ; i++)
{
  pre[i] += pre[i-1] + a[i] == '1';
}
for (int i =0 ; i < SZ(b) ;i++)ones += b[i] == '1';
for (int i =-1 , j = SZ(b)-1 ; j < SZ(a) ;i++,j++)
{
  int tem = pre[j] - (i>=0 ? pre[i] : 0 );
  if ( tem%2 == ones %2  )ans++;
}
printf ("%d\n" ,ans );
  cerr << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){

    string a,b;
    cin>>a>>b;
    int la = a.size(),lb=b.size();
    int _count=0,i,j,k,p;

    for(i=0;i<=la-lb;i++){
        int c=0;
        for(j=0,k=i+lb-1,p=lb-1;j<=k;j++,k--,p--){

            //cout<<i+j<<" "<<j<<" and "<<k<<" "<<p<<"\n";

            if(j!=k){
                if(a[i+j]!=b[j]) c++;
                if(a[k]!=b[p]) c++;
            }

            else if(a[i+j]!=b[j])
                    c++;
        }

        if(c%2==0) _count++;
    }

    cout<<_count<<"\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define PII pair<int,int>
const int mxn = 1e6+5;
int cnt[mxn];

void solve(){

   int i;
   string a,b;
   cin>>a>>b;

   int c=0;
   for(i=0; i<b.size(); i++)
        if(b[i]=='1')
            c++;

   for(i=0; i<a.size(); i++){
        if(a[i]=='1') cnt[i+1]=1;
        cnt[i+1]+=cnt[i];
   }

   c%=2;
   int res=0;
   for(i=b.size(); i<=a.size(); i++){
        int cc = cnt[i] - cnt[i-b.size()];
        cc%=2;
        if(cc==c) res++;
   }

   cout<<res<<"\n";

}

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    solve();

    return 0;

}


#include <bits/stdc++.h>
using namespace std;

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    string a,b;
    cin>>a>>b;
    int la = a.size(),lb=b.size();
    int _count=0,i,j,k,p;

    for(i=0;i<=la-lb;i++){
        int c=0;
        for(j=0,k=i+lb-1,p=lb-1;j<=p;j++,k--,p--){

            //cout<<i+j<<" "<<j<<" and "<<k<<" "<<p<<"\n";

            if(j!=p){
                if(a[i+j]!=b[j]) c++;
                if(a[k]!=b[p]) c++;
            }

            else if(a[i+j]!=b[j])
                    c++;
        }

        if(c%2==0) _count++;
    }

    cout<<_count<<"\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(){

    string a,b;
    cin>>a>>b;
    int la = a.size(),lb=b.size();
    int _count=0,i,j,k;

    for(i=0;i<=la-lb;i++){
        int c=0;
        for(j=0,k=i+lb-1;j<=k;j++,k--){
            if(j!=k){
                if(a[i+j]!=b[j]) c++;
                if(a[k]!=b[j+lb-1-i]) c++;
            }

            else if(a[i+j]!=b[j])
                    c++;
        }

        if(c%2==0) _count++;
    }

    cout<<_count<<"\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
bool f(string s1,int len)
{
	int cnt = 0;
	for (int i = 0; i < len; i++)
	{
		cnt += (s1[i] == '1');
	}
	return cnt;
}
int main()
{
	string s, t;
	cin >> s >> t;
	int ans = 0;
	int sums = f(s,t.size());
	int sumt = f(t,t.size());
	if ((sums + sumt) % 2 == 0)ans++;
	for (int i = t.size(); i < s.size(); i++) {
		sums -= (s[i - t.size()] == '1');
		sums += (s[i] == '1');
		if ((sums + sumt) % 2 == 0)ans++;
	}
	cout << ans << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
bool f(string s1,string t1)
{
	int ans=0;
	for(int i=0;i<s1.size();i++)
	{
		if(s1[i]!=t1[i])ans++;
	}
	return ans%2==0;
}
int main()
{
	string s;
	string t;
	cin>>s>>t;
	int cnt=0;
	for(int i=0;i<=s.size()-t.size();i++)
	{
		if(f(t,s.substr(i,t.size())))cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int oneCount(string st)
{
	int res = 0;
	for(int i = 0; i < st.size(); i++)
	{
		res += (st[i] == '1');
	}
	return res;
}
int main()
{
	string a, b;
	cin >> a >> b;
	int lenA = a.length();
	int lenB = b.length();
	int sumB = oneCount(b);
	int sumA = oneCount(a);
	int res=0;
	if((sumA + sumB) % 2 == 1)res++;
	for (int i = lenB; i < lenA; ++i) {
		sumA -= (a[i - lenB] == '1');
		sumA += (a[i] == '1');
		if((sumA + sumB) % 2 == 1)res++;
	}
	cout << res << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int oneCount(string st, int len)
{
	int res = 0;
	for(int i = 0; i < len; i++)
	{
		res += (st[i] == '1');
	}
	return res;
}
int main()
{
	string a, b;
	cin >> a >> b;
	int lenA = a.length();
	int lenB = b.length();
	int sumB = oneCount(b,b.size());
	int sumA = oneCount(a,b.size());
	int res=0;
	if((sumA + sumB) % 2 == 0)res++;
	for (int i = lenB; i < lenA; ++i) {
		sumA -= (a[i - lenB] == '1');
		sumA += (a[i] == '1');
		if((sumA + sumB) % 2 == 0)res++;
	}
	cout << res << endl;
	return 0;
}


#include<bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 10;
const int maxm = 2e5 + 10;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;

int main(){

	string str,b;
	cin >> str >> b;
	bitset<maxn>t(b);
	int ans = 0;
	for (int i = 0; i + b.size()-1 < str.size(); i++){
		bitset<maxn>a(str.substr(i, b.size()));
		if ((a^t).count() % 2 == 0)ans++;
	}
	cout << ans << endl;
	return 0;
}


#include<bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 10;
const int maxm = 2e5 + 10;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
ll pre[maxn];
int main(){

	string str,b;
	cin >> str >> b;
	bitset<maxn>t(b);
	str = " " + str;
	int ans = 0;
	for (int i = 1; i  < str.size(); i++){
		pre[i] = (str[i] - '0') ^ pre[i - 1];
	}
	for (int i = b.size(); i < str.size(); i++){
		bitset<maxn>t1((pre[i] ^ pre[i - b.size()]));
		t1 ^= t;
		if (t1.count() % 2 == 0)ans++;

	}
	cout << ans << endl;
	return 0;
}


#include<bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
const int maxn = 10 + 10;
const int maxm = 2e5 + 10;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
ll pre[maxn];
int main(){

	string a, b;
	cin >> a >> b;
	a = " " + a;
	int res = 0,ans=0;
	for (int i = 1; i < a.size(); i++)pre[i] = pre[i - 1] + (a[i] - '0');
	for (int i = 0; i < b.size(); i++)res += (b[i] - '0');
	for (int i = b.size(); i < a.size(); i++){
		if (((pre[i] - pre[i - b.size()]) % 2) == (res % 2))ans++;
	}
	cout << ans << endl;
	return 0;
}


#include<bits/stdc++.h>
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 10;
const int maxm = 2e5 + 10;
const ll linf = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
ll pre[maxn];
int main(){

	string a, b;
	cin >> a >> b;
	a = " " + a;
	int res = 0,ans=0;
	for (int i = 1; i < a.size(); i++)pre[i] = pre[i - 1] + (a[i] - '0');
	for (int i = 0; i < b.size(); i++)res += (b[i] - '0');
	for (int i = b.size(); i < a.size(); i++){
		if (((pre[i] - pre[i - b.size()]) % 2) == (res % 2))ans++;
	}
	cout << ans << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> ii;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define X first
#define Y second
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<
#define debug(...) fprintf(stderr, __VA_ARGS__)

string x, y;

int main()
{
  cin >> x >> y;
  int a = x.size(), b = y.size();
  int ab = 0, bb = 0;
  for (int i = 0; i < b; i++) {
    ab ^= x[i] - '0';
    bb ^= y[i] - '0';
  }
  int reza = 0;
  if (ab ^ bb == 0) reza++;
  for (int i = b; i < a; i++) {
    ab ^= x[i] - '0';
    ab ^= x[i - b] - '0';
    bb ^= y[i] - '0';
    bb ^= y[i - b] - '0';
    if (ab ^ bb == 0) reza++;
  }
  cout << reza;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> ii;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define X first
#define Y second
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<
#define debug(...) fprintf(stderr, __VA_ARGS__)

string x, y;

int main()
{
  cin >> x >> y;
  int a = x.size(), b = y.size();
  int ab = 0, bb = 0;
  for (int i = 0; i < b; i++) {
    ab ^= x[i] - '0';
    bb ^= y[i] - '0';
  }
  int reza = 0;
  if ((ab ^ bb) == 0) reza++;
  for (int i = b; i < a; i++) {
    ab ^= x[i] - '0';
    ab ^= x[i - b] - '0';
    bb ^= y[i] - '0';
    bb ^= y[i - b] - '0';
    if ((ab ^ bb) == 0) reza++;
  }
  cout << reza;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> ii;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define X first
#define Y second
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<
#define debug(...) fprintf(stderr, __VA_ARGS__)

string x, y;

int main()
{
  cin >> x >> y;
  int a = x.size(), b = y.size();
  int ab = 0, bb = 0;
  for (int i = 0; i < b; i++) {
    ab ^= x[i] - '0';
    bb ^= y[i] - '0';
  }
  int reza = 0;
  if ((ab ^ bb) == 0) reza++;//,cout<<"!";
  for (int i = b; i < a; i++) {
    ab ^= x[i] - '0';
    ab ^= x[i - b] - '0';
    bb ^= y[i] - '0';
    if ((ab ^ bb) == 0) reza++;//,cout<<i;
  }
  cout << reza;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> ii;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sqr(x) ((x) * (x))
#define X first
#define Y second
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<
#define debug(...) fprintf(stderr, __VA_ARGS__)

string x, y;

int main()
{
  cin >> x >> y;
  int a = x.size(), b = y.size();
  int ab = 0, bb = 0;
  for (int i = 0; i < b; i++) {
    ab ^= x[i] - '0';
    bb ^= y[i] - '0';
  }
  int reza = 0;
  if ((ab ^ bb) == 0) reza++;//,cout<<"!";
  for (int i = b; i < a; i++) {
    ab ^= x[i] - '0';
    ab ^= x[i - b] - '0';
    if ((ab ^ bb) == 0) reza++;//,cout<<i;
  }
  cout << reza;
  return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=1000010;
int l1,l2,nww,cnt,ans;
char a[maxn],b[maxn];
int main()
{
    scanf("%s%s",a+1,b+1);
    l1=strlen(a+1);l2=strlen(b+1);
    for(int i=1;i<=l2;i++)if(a[i]!=b[i])nww++;
    for(int i=1;i<l2;i++)if(b[i]!=b[i+1])cnt++;
    cnt=cnt%2;
    if(nww%2==0)ans++;
    for(int l=1,r=l2;r<l1;l++,r++)
    {
        if(a[l]!=b[1])nww++;
        if(a[r+1]!=b[l2])nww++;
        nww+=cnt;
        if(nww%2==0)ans++;
    }
    printf("%d\n",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;long long n,cnt,ans;char a[200001],b[200001];int main(){scanf("%s%s",a+1,b+1);long long l1=strlen(a+1),l2=strlen(b+1);for(int i=1;i<=l2;i++)if(a[i]!=b[i])n++;for(int i=1;i<l2;i++)if(b[i]!=b[i+1])cnt++;cnt=cnt%2;if(n%2==0)ans++;for(int l=1,r=l2;r<l1;l++,r++){if(a[l]!=b[1])n++;if(a[r+1]!=b[l2])n++;n+=cnt;if(n%2==0)ans++;}printf("%d\n",ans);return 0;}


#include <iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cstdio>
#include<map>
//#include<bits/stdc++.h>
#include<cmath>
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;

const int N=1e6+10;
int t,m,n,q,mx,k;
int ans;
int ar[N],sum[1000005],blo[N];
char ac[N],ak[N];

struct group{
double real;
int ans;
int id;
}nb[N];
int main()
{
    int sum1=0;
    int sum2=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%lf",&nb[i].real);
        int temp=nb[i].real;
        if(temp>=0) sum1+=temp;
        else sum2-=temp;
        nb[i].id=i;
    }
    if(sum1==sum2)
        for(int i=1;i<=n;i++)
    {
        printf("%d\n",(int)nb[i].real);
    }
    else if(sum1>sum2)
    {
        int d=sum1-sum2;
        for(int i=1;i<=n;i++)
        {
            if(nb[i].real<0)
            {
                if(d>0)
                {
                    d--;
                    printf("%d\n",(int)nb[i].real-1);
                }
                else
                    printf("%d\n",(int) nb[i].real);
            }
            else
                printf("%d\n",(int)nb[i].real);
        }

    }
    else
    {
        int d=sum2-sum1;
        for(int i=1;i<=n;i++)
        {
            if(nb[i].real>=0)
            {
                if(d>0)
                {
                    d--;
                    printf("%d\n",(int)nb[i].real+1);
                }
                else
                    printf("%d\n",(int)nb[i].real);
            }
            else
                printf("%d\n",(int)nb[i].real);
        }
    }

    return 0;
}


#include <iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cstdio>
#include<map>
//#include<bits/stdc++.h>
#include<cmath>
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;

const int N=1e6+10;
int t,m,n,q,mx,k;
int ans;
int ar[N],sum[1000005],blo[N];
char ac[N],ak[N];
int main()
{
    scanf("%s %s",ac,ak);
    int len=strlen(ac);
    int s=strlen(ak);
    for(int i=0;i+s<=len;i++)
    {
        int cnt=0;
        for(int j=0;j<s;j++)
        {
            if(ac[i+j]!=ak[j])
                cnt++;
        }
        if(!(cnt&1))
            ans++;
    }
    cout<<ans<<endl;
    return 0;
}


#include <iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cstdio>
#include<map>
//#include<bits/stdc++.h>
#include<cmath>
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;

const int N=1e6+10;
int t,m,n,q,mx,k;
int ans;
int ar[N],sum[1000005],blo[N];
char ac[N],ak[N];
int main()
{
    scanf("%s %s",ac,ak);
    int len=strlen(ac);
    int s=strlen(ak);
    for(int i=0;i+s<len;i++)
    {
        int cnt=0;
        for(int j=0;j<s;j++)
        {
            if(ac[i+j]!=ak[j])
                cnt++;
        }
        if(!(cnt&1))
            ans++;
    }
    cout<<ans<<endl;
    return 0;
}


#include <iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<cstdio>
#include<map>
//#include<bits/stdc++.h>
#include<cmath>
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;

const int N=1e6+10;
int t,m,n,q,mx,k;
int ans;
int ar[N],sum[1000005],blo[N];
char ac[N],ak[N];
int main()
{
    scanf("%s %s",ac,ak);
    int len=strlen(ac);
    int s=strlen(ak);
    int l=0;
    int r=0;
    int cnt=0;
    for(int i=0;i<s;i++)
        cnt=cnt^ac[i]^ak[i];
    if(!(cnt&1))
        ans++;
    for(int i=s;i<len;i++)
    {
       cnt=cnt^ac[i]^ac[i-s];
        if(!(cnt&1))
        ans++;
    }

    cout<<ans<<endl;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)

inline int read()
{
	int data = 0, w = 1; char ch = getchar();
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') w = -1, ch = getchar();
	while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();
	return data * w;
}

const int maxn(1e6 + 10);
char A[maxn], B[maxn]; int n, m, ans, cnt, pre;

int main()
{
	scanf("%s%s", A + 1, B + 1), n = strlen(A + 1), m = strlen(B + 1);
	for (int i = 1; i <= m; i++) cnt ^= A[i] != B[i]; ans += cnt ^ 1;
	for (int i = 1; i < m; i++) pre ^= B[i] != B[i + 1];
	for (int i = m + 1; i <= n; i++) cnt ^= A[i - m] != B[1], cnt ^= A[i] != B[m], cnt ^= pre, ans += cnt ^ 1;
	printf("%d\n", ans);
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)

inline int read()
{
	int data = 0, w = 1; char ch = getchar();
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') w = -1, ch = getchar();
	while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();
	return data * w;
}

const int maxn(1e6 + 10);
char A[maxn], B[maxn]; int n, m, ans, cnt, pre;

int main()
{
	scanf("%s%s", A + 1, B + 1), n = strlen(A + 1), m = strlen(B + 1);
	for (int i = 1; i <= m; i++) cnt ^= A[i] != B[i]; ans += cnt ^ 1;
	for (int i = 1; i < m; i++) pre ^= B[i] != B[i + 1];
	for (int i = m + 1; i <= n; i++) cnt ^= A[i - m] != B[1], cnt ^= A[i] != B[m], ans += cnt ^ 1;
	printf("%d\n", ans);
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)

inline int read()
{
	int data = 0, w = 1; char ch = getchar();
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') w = -1, ch = getchar();
	while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();
	return data * w;
}

const int maxn(1e6 + 10);
char A[maxn], B[maxn]; int n, m, ans, cnt;

int main()
{
	scanf("%s%s", A + 1, B + 1), n = strlen(A + 1), m = strlen(B + 1);
	for (int i = 1; i <= m; i++) cnt += A[i] != B[i]; ans += (cnt % 2 == 0);
	for (int i = m + 1; i <= n; i++) cnt -= A[i - m] != B[1], cnt += A[i] != B[m], ans += (cnt % 2 == 0);
	printf("%d\n", ans);
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)

inline int read()
{
	int data = 0, w = 1; char ch = getchar();
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') w = -1, ch = getchar();
	while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();
	return data * w;
}

const int maxn(1e6 + 10);
char A[maxn], B[maxn]; int n, m, ans, cnt;

int main()
{
	scanf("%s%s", A + 1, B + 1), n = strlen(A + 1), m = strlen(B + 1);
	for (int i = 1; i <= m; i++) cnt += A[i] != B[i], ans += (cnt & 1);
	for (int i = m + 1; i <= n; i++) cnt -= A[i - m] != B[1], cnt += A[i] != B[m], ans += (cnt & 1);
	printf("%d\n", ans);
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <cstring>

using namespace std;

void file_io(){
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
}

map<string, bool> ans;

bool f(string b, string c)
{
    if (ans.find(c) != ans.end())
        return ans[c];

    int cnt = 0;
    for (int i = 0; i < b.size(); i++)
    {
        if (b[i] != c[i])
            cnt++;
    }

    return cnt % 2 == 0 && cnt != 0;
}

int main()
{
    string s, t;
    cin >> s >> t;

    int cnt = 0;
    for (int i = 0; i + t.size() < s.size() + 1; i++)
    {
        string c = s.substr(i, t.size());
        if (f(t, c))
            cnt++;
    }
    cout << cnt;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <cstring>

using namespace std;

void file_io(){
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
}

int main()
{
    string a, b;
    cin >> a >> b;

    int b_cnt = 0;
    for (int i = 0; i < b.size(); i++)
        if (b[i] == '1')
            b_cnt++;

    int a_cnt[a.size()+1];
    a_cnt[0] = 0;

    for (int i = 1; i <= a.size(); i++)
    {
        a_cnt[i] = a_cnt[i-1] + (a[i-1] == '1' ? 1 : 0);
    }

    int cnt = 0;
    for (int i = 0; i + b.size() < a.size() + 1; i++)
    {
        // s[i : i_|b|-1]
        // a_cnt[]
        int an = a_cnt[i + b.size()] - a_cnt[i];
        if (b_cnt % 2 == 1 && an % 2 == 1) cnt++;
        if (b_cnt % 2 == 0 && an % 2 == 0) cnt++;

    }

    cout << cnt;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <cstring>

using namespace std;

void file_io(){
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
}

map<string, bool> ans;

bool f(string b, string c)
{
    if (ans.find(c) != ans.end())
        return ans[c];

    int cnt = 0;
    for (int i = 0; i < b.size(); i++)
    {
        if (b[i] != c[i])
            cnt++;
    }
    ans[c] = cnt % 2 == 0 && cnt != 0;
    return cnt % 2 == 0 && cnt != 0;
}

int main()
{
    string s, t;
    cin >> s >> t;

    int cnt = 0;
    for (int i = 0; i + t.size() < s.size() + 1; i++)
    {
        string c = s.substr(i, t.size());
        if (f(t, c))
            cnt++;
    }
    cout << cnt;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <cstring>

using namespace std;

void file_io(){
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
}

bool f(string b, string c)
{
    int cnt = 0;
    for (int i = 0; i < b.size(); i++)
    {
        if (b[i] != c[i])
            cnt++;
    }

    return cnt % 2 == 0 && cnt != 0;
}

int main()
{
    string s, t;
    cin >> s >> t;

    int cnt = 0;
    for (int i = 0; i + t.size() - 1 < s.size(); i++)
    {
        string c = s.substr(i, t.size());
        if (f(t, c))
            cnt++;
    }
    cout << cnt;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <cstring>

using namespace std;

void file_io(){
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
}

int main()
{
    string a, b;
    cin >> a >> b;
    int num_of_substrings = a.size() - b.size() + 1;
    int count[num_of_substrings];
    memset(count, 0, sizeof count);
    for (int i = 0; i < b.size(); i++)
    {
        for (int j = i; j < i + num_of_substrings; j++)
        {
            if (b[i] != a[j])
                count[j - i]++;
        }
    }

    int answer = 0;
    for (int i : count)
        if (i % 2 == 0 && i != 0)
            answer++;

    cout << answer;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll d[100001];
int main()
{
string a,b;
cin>>a>>b;
ll c=count(b.begin(),b.end(),'1');
d[0]=a[0]-'0';
for(ll i=1;i<a.size();i++)
        d[i]=(a[i]=='1')+d[i-1];
ll an=0;
for(ll l=0,r=b.size()-1;r<a.size();l++,r++)
{
ll s=d[r]-(l==0?0:d[l-1]);
an+=(s%2==c%2);
}
cout<<an<<endl;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll d[1000001];
int main()
{
string a,b;
cin>>a>>b;
ll c=count(b.begin(),b.end(),'1');
d[0]=a[0]-'0';
for(ll i=1;i<a.size();i++)
        d[i]=(a[i]=='1')+d[i-1];
ll an=0;
for(ll l=0,r=b.size()-1;r<a.size();l++,r++)
{
ll s=d[r]-(l==0?0:d[l-1]);
an+=(s%2==c%2);
}
cout<<an<<endl;


#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll d[100001];
int main()
{
string a,b;
cin>>a>>b;
ll c=count(b.begin(),b.end(),'1');
d[0]=a[0]-'0';
for(ll i=1;i<a.size();i++)
        d[i]=(a[i]=='1')+d[i-1];
ll an=0;
for(ll l=0,r=b.size()-1;r<a.size();l++,r++)
{
ll s=d[r]-(l==0?0:d[l-1]);
an+=(s%2==c%2);
}
cout<<an<<endl;


//{
#include<bits/stdc++.h>
#define ll long long
#define pp pair<ll,ll>
#define fr(i,n) for(ll i=0;i<n;i++)
#define fi(i,j,n) for(ll i=j;i<=n;i++)
#define mod 1000000007
#define pi acos(-1)
#define INF 1000000000
#define EPS 1e-9

using namespace std;
//}
int main()
{string a,b;
cin>>a>>b;
ll d=0;
fr(i,b.size())if(a[i]!=b[i])d++;
ll an=0;

for(ll l=0,r=b.size()-1;r<a.size();)
{if(d%2==0)an++;
if(a[l]==b[0])d--;l++;
r++;

if(r<a.size()&&a[r]==b[b.size()-1])d++;

}
cout<<an<<endl;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll d[1000001];
int main()
{
string a,b;
cin>>a>>b;
ll c=count(b.begin(),b.end(),'1');
d[0]=a[0]-'0';
for(ll i=1;i<a.size();i++)
        d[i]=(a[i]=='1')+d[i-1];
ll an=0;
for(ll l=0,r=b.size()-1;r<a.size();l++,r++)
{
ll s=d[r]-(l==0?0:d[l-1]);
an+=(s%2==c%2);
}
cout<<an<<endl;
}


#include <iostream>
#define ll long long
using namespace std;
int main()
{
    string a,b;
    cin >> a;
    cin >> b;
    ll ans = 0,cnt = 0;
    for(int i=0;i<=a.size()-b.size();i++){
        cnt = 0;
        for(int j=0;j<b.size();j++){
            if(b[j] != a[i+j]) cnt++;
        }
        if(cnt%2 == 0) ans++;
    }
    cout << ans;
    return 0;
}


#include <iostream>
#define ll long long
using namespace std;
int main()
{
    string a,b;
    cin >> a;
    cin >> b;
    ll cnt = 0,ans = 0;
    for(int i=0;i<a.size()-b.size();i++){
        string sub = a.substr(i,b.size());
        //cout << sub << endl;
        cnt = 0;
        for(int j=0;j<b.size();j++){
            if(sub[j] != b[j]) cnt++;
        }
        if(cnt%2 == 0) ans++;
    }
    cout << ans;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
    ll cnta = 0, cntb = 0;
    ll ans = 0;
    string a,b;
    cin >> a >> b;
    for(int i=0;i<b.size();i++){
        if(a[i] == '1') cnta++;
        if(b[i] == '1') cntb++;
    }
    if((cnta - cntb)%2 == 0) ans++;
    for(int i=b.size();i<a.size();i++){
        if(a[i-b.size()] == '1') cnta--;
        if(a[i] == '1') cnta++;
        if((cnta-cntb)%2 == 0) ans++;
    }
    cout << ans;
    return 0;
}


#include <iostream>
using namespace std;
int main()
{
    string a,b;
    cin >> a;
    cin >> b;
    int cnt = 0,ans = 0;
    for(int i=0;i<a.size()-b.size();i++){
        string sub = a.substr(i,b.size());
        //cout << sub << endl;
        cnt = 0;
        for(int j=0;j<b.size();j++){
            if(sub[j] != b[j]) cnt++;
        }
        if(cnt%2 == 0) ans++;
    }
    cout << ans;
    return 0;
}


#include <iostream>
#define ll long long
using namespace std;
int main()
{
    string a,b;
    cin >> a;
    cin >> b;
    ll cnt = 0,ans = 0;
    for(int i=0;i<=a.size()-b.size();i++){
        string sub = a.substr(i,b.size());
        cnt = 0;
        for(int j=0;j<b.size();j++){
            if(sub[j] != b[j]) cnt++;
        }
       // cout << sub <<  " " << cnt << endl;
        if(cnt%2 == 0) ans++;
    }
    cout << ans;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e6;
char s1[MAXN],s2[MAXN];
int n,m;
int main(){
	scanf("%s",s1+1);
	scanf("%s",s2+1);
	n=strlen(s1+1);
	m=strlen(s2+1);
	int flag = 0;/*
	for(int i=1;i<m;i++){
		if(s2[i] != s2[i+1])
			flag ^= 1;
	}*/
	flag ^= s2[1] ^ s2[m];
//	flag ^= 1;
//	int cur = 0;
	int ans = 0;
	int tmp = 0;
	for(int i=1;i<=m;i++){
		if(s1[i] != s2[i])
			tmp ^= 1;
	}
	if(!tmp) ans ++;
	int point = m;
	while(point < n){
		point ++;
		tmp ^= flag;
		if(s1[point-m]!=s2[1])
			tmp ^= 1;
	//	tmp = cur;
		if(s1[point] != s2[m]){
			tmp ^= 1;
		}
		if(!tmp){
			ans ++;
		//	cout<<point<<" \n";
		}
	}
	cout<<ans;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e6;
char s1[MAXN],s2[MAXN];
int n,m;
int main(){
	scanf("%s",s1+1);
	scanf("%s",s2+1);
	n=strlen(s1+1);
	m=strlen(s2+1);
	int flag = 0;
	for(int i=1;i<m;i++){
		if(s2[i] != s2[i+1])
			flag ^= 1;
	}
	int cur = 0;
	int ans = 0;
	for(int i=1;i<m;i++){
		if(s1[i] != s2[i])
			cur ^= 1;
	}
	int tmp = cur;
	if(s1[m] != s2[m])
		tmp ^= 1;
	if(!tmp) ans ++;
	int point = m;
	while(point < n){
		point ++;
		cur ^= flag;
		if(s1[point-m]!=s2[1])
			cur ^= 1;
		tmp = cur;
		if(s1[point] != s1[point-1]){
			tmp ^= 1;
		}
		if(!tmp){
			ans ++;
			//cout<<point<<" \n";
		}
	}
	cout<<ans;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5;
int n;
double data[MAXN],re[MAXN];
int main(){
//	cout<<ceil(-1.7);
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lf",data+i);
		re[i] = data[i] - (int)data[i];
		re[i] += re[i-1];
	}
	int t = (int)re[n];
//	cout<<t<<endl;
	int cnt = 0;
	if(t>0){
		for(int i=1;i<=n;i++){
			if(data[i]>0){
				data[i] = ceil(data[i]);
				cnt++;
				if(cnt == t)
					break;
			}
		}
	}else if(t < 0){
		for(int i=1;i<=n;i++){
			if(data[i]<0){
				data[i] = floor(data[i]);
				cnt++;
				if(-cnt == t)
					break;
			}
		}
	}
	for(int i=1;i<=n;i++)
		printf("%d\n",(int)data[i]);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e6;
char s1[MAXN],s2[MAXN];
int n,m;
int main(){
	scanf("%s",s1+1);
	scanf("%s",s2+1);
	n=strlen(s1+1);
	m=strlen(s2+1);
	int flag = 0;
	for(int i=1;i<m;i++){
		if(s2[i] != s2[i+1])
			flag ^= 1;
	}
//	flag ^= 1;
//	int cur = 0;
	int ans = 0;
	int tmp = 0;
	for(int i=1;i<m;i++){
		if(s1[i] != s2[i])
			tmp ^= 1;
	}

	if(s1[m] != s2[m])
		tmp ^= 1;
	if(!tmp) ans ++;
	int point = m;
	while(point < n){
		point ++;
		tmp ^= flag;
		if(s1[point-m]!=s1[point - m + 1])
			tmp ^= 1;
	//	tmp = cur;
		if(s1[point] != s1[point-1]){
			tmp ^= 1;
		}
		if(!tmp){
			ans ++;
		//	cout<<point<<" \n";
		}
	}
	cout<<ans;
	return 0;
}


#include<cstdio>
#include<cstring>
using namespace std;
char a[1000005],b[1000005];
int l1,l2,ans,sum,cnt;
int main()
{
  scanf("%s%s",a+1,b+1);
  l1=strlen(a+1);l2=strlen(b+1);
  for(int i=1;i<=l2;i++)
    if(a[i]!=b[i])  cnt++;
  for(int i=1;i<l2;i++)
    if(b[i]!=b[i+1])  sum++;
  if(cnt%2==0)  ans++;
  for(int l=2,r=l2+1;r<=l1;l++,r++)
  {
    if(b[1]!=a[l-1])  cnt++;
    if(b[l2]!=a[r])  cnt++;
    cnt=(cnt+sum)%2;
    if(cnt==0)  ans++;
  }
  printf("%d",ans);
}


#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
	string a,b;
	cin>>a>>b;
	int res=0,cnt=0,ans=0;

	for(int i=0;i<b.length();i++)
		if(a[i]!=b[i]) res++;
	for(int i=0;i<b.length()-1;i++)
		if(b[i]!=b[i+1]) cnt++;
    cnt=cnt%2;
    if(res%2==0) ans++;

    for(int l=0,r=b.length()-1;r<a.length()-1;l++,r++)
    {
        if(a[l]!=b[0]) res++;
        if(a[r+1]!=b[b.length()-1]) res++;
        res+=cnt;
        if(res%2==0) ans++;
    }
	cout<<ans;
	return 0;
}


#include<bits/stdc++.h>
#define rnt register int
#define maxn 1001000
#define int long long
using namespace std;
inline int read()
{
	int x=0,f=1;char c;
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-f;
	for(;isdigit(c);c=getchar()) x=(x<<1)+(x<<3)+(c^48);
	return x*f;
}
char a[maxn],b[maxn];
int lena,lenb,ans,suma[maxn],sumb;
signed main()
{
//	freopen("string.in","r",stdin);
//	freopen("string.out","w",stdout);
	cin >> (a+1) >> (b+1);
	lena=strlen(a+1),lenb=strlen(b+1);
	suma[0]=0;
	for(rnt i=1;i<=lena;i++) suma[i]=suma[i-1]+(a[i]^48);
	for(rnt i=1;i<=lenb;i++) sumb+=(b[i]^48);
//	for(rnt i=1;i<=lena;i++) cout << suma[i] << ' ';
//	cout << endl;
	for(rnt i=1;i+lenb-1<=lena;i++)
	{
		if((sumb+suma[i+lenb-1]-suma[i-1])%2==0) ans++;
	}
	cout << ans << endl;
	return 0;
}
/*
a  : 1010111110
sum: 1122345677
b  : 0110 2
4
*/


#include <cstdio>
#include <cctype>
#include <cstring>
#include <bitset>
#define reg register
using namespace std;
const int MaxN=1000001;
template <class t> inline void rd(t &s)
{
	s=0;
	reg char c=getchar();
	while(!isdigit(c))
		c=getchar();
	while(isdigit(c))
		s=(s<<3)+(s<<1)+(c^48),c=getchar();
	return;
}
char ia[MaxN],ib[MaxN];
int a[MaxN],b[MaxN],f[MaxN],g[MaxN];
int lena,lenb;
signed main(void)
{
	scanf("%s%s",ia+1,ib+1);
	lena=strlen(ia+1),lenb=strlen(ib+1);
//	printf("%d %d",lena,lenb);
	for(int i=1;i<=lena;++i)
	{
		a[i]=(ia[i]=='1')?1:0;
		f[i]=f[i-1]+a[i];
	}
	for(int i=1;i<=lenb;++i)
	{
		b[i]=(ib[i]=='1')?1:0;
		g[i]=g[i-1]^b[i];
	}
	reg int ans=0,k,u;
	for(int i=lenb;i<=lena;++i)
	{
		u=i-lenb+1;
		k=(f[i]-f[u-1])&1;
		k=!k;
		ans+=k^g[lenb];
	}
		//ans+=!((f[i]-f[i-lenb])&1)^g[lenb];
	printf("%d",ans);
	return 0;
}


#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
const int maxn = 1e6 + 5;
char a[maxn], b[maxn];
int ans, cnt, cur;
int main() {
	scanf("%s %s", a+1, b+1);
	int lena = strlen(a+1), lenb = strlen(b+1);
	for(int i = 1; i < lenb; ++i)
		if(b[i] != b[i+1]) cnt ^= 1;
	for(int i = 1; i <= lenb; ++i)
		if(a[i] != b[i]) cur ^= 1;
	if(!cur) ++ans;
	for(int l = 1, r = lenb; r < lena; ++l, ++r) {
		if(a[l] ^ b[1]) cur ^= 1;
		if(a[r+1] ^ b[lenb]) cur ^= 1;
		cur ^= cnt;
		if(!cur) ++ans;
	}
	printf("%d\n", ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define next Next
#define int long long
const int N=1e6+35;
int n,m,now,ans,st,xu[N];
char a[N],b[N];
//char buf[1<<21],*p1=buf,*p2=buf;
//inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
#define gc getchar
inline int read()
{
    int ret=0,f=0;char c=gc();
    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
    if(f)return -ret;return ret;
}
signed main()
{
    scanf("%s",a+1);
    n=strlen(a+1);
	scanf("%s",b+1);
	m=strlen(b+1);
    for(int i=1;i<=m;i++)
        if(a[i]!=b[i])now^=1;
    for(int i=1;i<n;i++)
        if(a[i]!=a[i+1])xu[i]=1;
    for(int i=1;i<=m;i++)st^=xu[i];
    if(!now)ans++;
    for(int i=1;i<=n-m;i++)
	{
        now^=st;
        if(!now)ans++;
        st^=xu[i]^xu[i+m];
    }
   	cout<<ans;
    return 0;
}


#include <cstdio>
#include <algorithm>
#include <cstring>
const int MAXN = 1e6 + 1;
int na , nb , cnt , ans;
char str[2][MAXN];
int main( void ){
    scanf("%s",str[0]+1);
    scanf("%s",str[1]+1);
    na = strlen( str[0] + 1 );
    nb = strlen( str[1] + 1 );
    for( int i = 1 ; i <= nb ; ++i )
        if( str[0][i] != str[1][i] ) ++cnt;
    if( !(cnt&1) ) ++ans;
    for( int i = nb + 1 ; i <= na ; ++i ){
        cnt -= ( str[0][i - nb] != str[1][1] );
        cnt += ( str[0][i] != str[1][nb] );
        if( !(cnt&1) ) ++ans;
    }
    printf("%d",ans);
}


#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
string a,b;
int ans=0,sum=0;
int main()
{
    cin>>a>>b;
    int len_a=a.length();
    int len_b=b.length();
    for(int i=0;i<len_b;i++)
	{
        ans+=a[i]^b[i];
    }
    if(ans%2==0) sum++;
    for(int i=len_b;i<len_a;i++)
	{
        ans+=a[i-len_b]^a[i];
        if(ans%2==0) sum++;
    }
    cout<<sum;
    return 0;
}


#include<stdio.h>
#include<string.h>
const int maxn=1000005;
int main()
{char a[maxn],b[maxn];
scanf("%s%s",a,b);
int L=strlen(a),l=strlen(b),ans=0;
for(int i=0;i<L-l;i++)
	{int num=0;
	for(int j=0;j<l;j++)
		if(a[i+j]!=b[j])
			num++;
	if(num%2==0)
		ans++;}
printf("%d",ans);}


#include<stdio.h>
#include<string.h>
const int maxn=1000005;
int main()
{char a[maxn],b[maxn];
scanf("%s%s",a,b);
int L=strlen(a),l=strlen(b),ans=0,num=0,sum=0;
for(int i=0;i<l;i++)
{if(a[i]!=b[i])
	num++;
if(a[i]!=a[i+1])
	sum++;}
if(num%2==0)
	ans=1;
for(int i=1;i<=L-l;i++)
	{if((sum+num)%2==0)
	ans++;
	if(a[i-1]!=a[i])
		sum--;
	if(a[i+l-1]!=a[i+l])
		sum++;}
printf("%d",ans);}


#include<stdio.h>
#include<string.h>
const int maxn=1000005;
int main()
{char a[maxn],b[maxn];
scanf("%s%s",a,b);
int L=strlen(a),l=strlen(b),ans=0,num=0,sum=0;
for(int i=0;i<l;i++)
{if(a[i]!=b[i])
	num++;
if(a[i]!=a[i+1])
	sum++;}
if(num%2==0)
	ans=1;
for(int i=1;i<=L-l;i++)
	{num+=sum;
num%=2;
if(num==0)
	ans++;
	if(a[i-1]!=a[i])
		sum--;
	if(a[i+l-1]!=a[i+l])
		sum++;}
printf("%d",ans);}


#include<stdio.h>
#include<string.h>
const int maxn=100005;
int main()
{char a[maxn],b[maxn];
scanf("%s%s",a,b);
int L=strlen(a),l=strlen(b),ans=0;
for(int i=0;i<=L-l;i++)
	{int num=0;
	for(int j=0;j<l;j++)
		if(a[i+j]!=b[j])
			num++;
	if(num%2==0)
		ans++;}
printf("%d",ans);}


#include<iostream>
#include<string>
#define endl '\n'
#define IO ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main(){
    IO;
    string a,b;
    int nums[100050];
    cin>>a>>b;
    int la=a.length();
    int lb=b.length();
    int output=0;
    int total;
    nums[0]=0;
    int rev=0;
    for(int i=0;i<lb;i++){
        nums[0]+=a[i]-'0';
        if(b[i]=='1')rev++;
    }
    for(int i=1;i<=la-lb;i++){
        nums[i]=nums[i-1]-(a[i-1]^a[i-1+lb]);
    }
    for(int i=0;i<=la-lb;i++){
        if((nums[i]+rev)%2==0)output++;
    }
    cout<<output<<endl;
}


#include<iostream>
#include<string>
#define endl '\n'
#define IO ios_base::sync_with_stdio(0);
using namespace std;
int main(){
    IO;
    string a,b;
    cin>>a>>b;
    int la=a.length();
    int lb=b.length();
    int output=0;
    int total;
    for(int i=0;i<=la-lb;i++){
        total=0;
        for(int j=0;j<lb;j++){
            if(a[i+j]^b[j])total++;
        }
        if(total%2==0)output++;
    }
    cout<<output;
}


#include<iostream>
#include<string>
#define endl '\n'
#define IO ios_base::sync_with_stdio(0);
using namespace std;
int main(){
    IO;
    string a,b;
    cin>>a>>b;
    int la=a.length();
    int lb=b.length();
    int output=0;
    int total;
    for(int i=0;i<la-lb;i++){
        total=0;
        for(int j=0;j<lb;j++){
            if(a[i+j]^b[j])total++;
        }
        if(total%2==0)output++;
    }
    cout<<output;
}


#include<iostream>
#include<string>
#define endl '\n'
#define IO ios_base::sync_with_stdio(0);
using namespace std;
int main(){
    IO;
    string a,b;
    int nums[100005];
    cin>>a>>b;
    int la=a.length();
    int lb=b.length();
    int output=0;
    int total;
    nums[0]=0;
    int rev=0;
    for(int i=0;i<lb;i++){
        nums[0]+=a[i]-'0';
        if(b[i]=='1')rev++;
    }
    for(int i=1;i<=la-lb;i++){
        nums[i]=nums[i-1]-(a[i-1]^a[i-1+lb]);
    }
    for(int i=0;i<=la-lb;i++){
        if((nums[i]+rev)%2==0)output++;
    }
    cout<<output<<endl;
}


#include<iostream>
#include<string>
#define endl '\n'
#define IO ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main(){
    IO;
    string a,b;
    int nums[105005];
    cin>>a>>b;
    int la=a.length();
    int lb=b.length();
    int output=0;
    int total;
    nums[0]=0;
    int rev=0;
    for(int i=0;i<lb;i++){
        nums[0]+=a[i]-'0';
        if(b[i]=='1')rev++;
    }
    for(int i=1;i<=la-lb;i++){
        nums[i]=nums[i-1]-(a[i-1]^a[i-1+lb]);
    }
    for(int i=0;i<=la-lb;i++){
        if((nums[i]+rev)%2==0)output++;
    }
    cout<<output<<endl;
}


#include<iostream>
#include<string>
#define endl '\n'
#define IO ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main(){
    IO;
    string a,b;
    int nums[1000050];
    cin>>a>>b;
    int la=a.length();
    int lb=b.length();
    int output=0;
    int total;
    nums[0]=0;
    int rev=0;
    for(int i=0;i<lb;i++){
        nums[0]+=a[i]-'0';
        if(b[i]=='1')rev++;
    }
    for(int i=1;i<=la-lb;i++){
        nums[i]=nums[i-1]-(a[i-1]^a[i-1+lb]);
    }
    for(int i=0;i<=la-lb;i++){
        if((nums[i]+rev)%2==0)output++;
    }
    cout<<output<<endl;
}


#include<iostream>
#include<string>
#include<vector>
#define endl '\n'
#define IO ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main(){
    IO;
    string a,b;
    cin>>a>>b;
    int la=a.length();
    int lb=b.length();
    int output=0;
    int total;
    int sum=0;
    int rev=0;
    for(int i=0;i<lb;i++){
        sum+=a.at(i)-'0';
        if(b.at(i)=='1')rev++;
    }
    for(int i=1;i<=la-lb;i++){
        if((sum+rev)%2==0)output++;
        sum=sum-(a.at(i-1)^a.at(i-1+lb));
    }
    cout<<output<<endl;
}


#include<iostream>
#include<string>
#include<vector>
#define endl '\n'
#define IO ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main(){
    IO;
    string a,b;
    int nums[100005];
    cin>>a>>b;
    int la=a.length();
    int lb=b.length();
    int output=0;
    int total;
    *nums=0;
    int rev=0;
    for(int i=0;i<lb;i++){
        *nums+=a.at(i)-'0';
        if(b.at(i)=='1')rev++;
    }
    for(int i=1;i<=la-lb;i++){
        *(nums+i)=*(nums+i-1)-(a.at(i-1)^a.at(i-1+lb));
    }
    for(int i=0;i<=la-lb;i++){
        if((*(nums+i)+rev)%2==0)output++;
    }
    cout<<output<<endl;
}


#include<iostream>
#include<string>
#include<vector>
#define endl '\n'
#define IO ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main(){
    IO;
    string a,b;
    vector<int> nums;
    cin>>a>>b;
    int la=a.length();
    int lb=b.length();
    int output=0;
    int total;
    nums.push_back(0);
    int rev=0;
    for(int i=0;i<lb;i++){
        nums[0]+=a[i]-'0';
        if(b[i]=='1')rev++;
    }
    for(int i=1;i<=la-lb;i++){
        nums.push_back(nums[i-1]-(a[i-1]^a[i-1+lb]));
    }
    for(int i=0;i<=la-lb;i++){
        if((nums[i]+rev)%2==0)output++;
    }
    cout<<output<<endl;
}


#include<iostream>
#include<string>
#define endl '\n'
#define IO ios_base::sync_with_stdio(0);
#define int long long
using namespace std;
signed main(){
    IO;
    string a,b;
    int nums[100005];
    cin>>a>>b;
    int la=a.length();
    int lb=b.length();
    int output=0;
    int total;
    int first;
    int rev=0;
    for(int i=0;i<lb;i++){
        first+=a[i];
        rev+=b[i];
    }
    nums[0]=first;
    for(int i=1;i<=la-lb;i++){
        nums[i]=nums[i-1]-a[i-1]+a[i-1+lb];
    }
    for(int i=0;i<=la-lb;i++){
        if((nums[i]+rev)%2==0)output++;
    }
    cout<<output<<endl;
}


#include<iostream>
#include<string>
#define endl '\n'
#define IO ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main(){
    IO;
    string a,b;
    int nums[100005];
    cin>>a>>b;
    int la=a.length();
    int lb=b.length();
    int output=0;
    int total;
    nums[0]=0;
    int rev=0;
    for(int i=0;i<lb;i++){
        nums[0]+=a[i]-'0';
        if(b[i]=='1')rev++;
    }
    for(int i=1;i<=la-lb;i++){
        nums[i]=nums[i-1]-(a[i-1]^a[i-1+lb]);
    }
    for(int i=0;i<=la-lb;i++){
        if((nums[i]+rev)%2==0)output++;
    }
    cout<<output<<endl;
}


#include <bits/stdc++.h>
using namespace std;

#define mod 1000000007
#define ll long long int
#define ld long double
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define frr(i,b,a) for(int i=b;i>=a;i--)
#define vi std::vector<int>
#define vpi std::vector<pair<int,int>>
#define pb push_back
#define mp make_pair
#define sall(v) sort(v.begin(),v.end())
#define all(v) (v.begin(),v.end())

bool b2(const pair<pair<int,int>,int> &p1,const pair<pair<int,int>,int> &p2){
	return p1.first.first>p2.first.first;

}
bool b1(const pair<pair<int,int>,int> &p1,const pair<pair<int,int>,int> &p2){
	return p1.first.second<p2.first.second;

}
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}

int scal(int a){
	int sum=0;
	while(a>0){
		sum+=a%10;
		a=a/10;
	}
	return sum;
}

int main(){

	string a,b;cin>>a>>b;
	int n = a.length();
	int m = b.length();
	int pp = n-m+1;
	int arr[pp+1];
	int strt;
	memset(arr,0,sizeof(arr));
	fr(qq,0,m-1){
		strt=1;
	fr(i,qq,n+qq-m){
		if(b[qq]!=a[i])arr[strt]++;
		strt++;
	}
	}
	int count=0;
	fr(i,1,pp)if(arr[i]%2==0)count++;
	cout<<count;
	return 0;
}


#include <bits/stdc++.h>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define M 1500000
#define MOD 1e14
#define ll long long
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define N 1e8

using namespace std;
typedef pair<int,int> ii;
typedef pair<string,string> is;
typedef pair<int,ii> iii;
typedef pair<ii,ii> iiii;

ll t[M];
ll maax;
ll miin;
int vis[M];
ll n,m,k,l,r,nb;
ll ans;
int so;
bool test;

map<int,int> mapp;
map<int,int> mapp1;
vector<int> v;
vector<int> v1;
set<string> st[200];
string s,s1;

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>s>>s1;
    n=s.length();
    m=s1.length();
    int cnt=0;
    for (int i=1;i<n;i++)
    {
        t[i]=(s[i]!=s[i-1]);
    }
    for (int i=1;i<n;i++)
        t[i]+=t[i-1];
    int res=0;
    for(int i=0;i<m;i++)
        if(s[i]!=s1[i])
            res++;
    res%=2;
    int ans=(!(res%2));
    for (int i=1;i<n-m+1;i++)
    {
        res=(res+t[i+m-1]-t[i-1])%2;
        ans+=(!(res%2));
    }
    cout<<ans;

}


#include<bits/stdc++.h>
using namespace std;

const int MAXN = 1e6;

int main() {
        ios_base:: sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        string s, t;
        cin >> s >> t;
        int n = s.length();
        //cout << n << '\n';
        int k = t.length();
        bitset<MAXN> pat(t);
        string c = "";
        int ans = 0;
        for(int i = 0; i < n; i++) {
                c = c + s[i];
                if(i >= (k - 1)) {
                        bitset<MAXN> bset(c);
                        bitset<MAXN> val = bset ^ pat;
                        int cnt = val.count();
                        if(cnt % 2 == 0)
                                ans++;
                        c.erase(c.begin());
                }
        }
        cout << ans;
        return 0;
}


#include <bits/stdc++.h>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define M 1500000
#define MOD 1e14
#define ll long long
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define N 1e8

using namespace std;
typedef pair<int,int> ii;
typedef pair<string,string> is;
typedef pair<int,ii> iii;
typedef pair<ii,ii> iiii;

ll t[M];
ll maax;
ll miin;
int vis[M];
ll n,m,k,l,r,nb;
ll ans;
int so;
bool test;

map<int,int> mapp;
map<int,int> mapp1;
vector<int> v;
vector<int> v1;
set<string> st[200];
string s,s1;

int main(){

    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>n>>m;
    ll cnt=0;
    k=n/3;
    if(n%3)
    {
        cnt+=((m+1)/2)*k;
        n-=k*3;
    }
    else
    {
        cnt+=((m+1)/2)*(k-1);
        n-=(k-1)*3;
    }
    if(n==1)
    cnt+=(m+1)/3;
    else if(n==2)
     cnt+=(m+1)/2;
    else
        cnt+=max(2*((m+1)/3)+((m%3)==1),(m+1)/2);
    cout<<cnt;

}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;

char a[1000010],b[1000010];
ll ans,now,cnt,lena,lenb;

int main(){
    scanf("%s%s",a+1,b+1);
    lena=strlen(a+1); lenb=strlen(b+1);
    for(ll i=1; i<=lenb; i++){
        if(a[i]!=b[i]) now++;
    }
    for(ll i=1; i<lenb; i++){
        if(b[i]!=b[i+1]) cnt++;
    }
    cnt&=1;
    if((now&1)==0) ans++;
    for(ll l=1,r=lenb; r<lena; l++,r++){
        if(a[l]!=b[1]) now++;
        if(a[r+1]!=b[lenb]) now++;
        now+=cnt;
        if((now&1)==0) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;

string a,b;
ll ans;

int main(){
    cin>>a>>b;
    for(ll i=0; i+b.size()-1<a.size(); i++){
        ll sum=0;
        for(ll j=0; j<b.size(); j++){
            if(a[i+j]!=b[j]) sum++;
        }
        if((sum&1)==0) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;

char a[1000010],b[1000010];
ll ans,now,cnt;

int main(){
    scanf("%s%s",a+1,b+1);
    for(ll i=1; i<=strlen(b+1); i++){
        if(a[i]!=b[i]) now++;
    }
    for(ll i=1; i<strlen(b+1); i++){
        if(b[i]!=b[i+1]) cnt++;
    }
    cnt&=1;
    if((now&1)==0) ans++;
    for(ll l=1,r=strlen(b+1); r<strlen(a+1); l++,r++){
        if(a[l]!=b[1]) now++;
        if(a[r+1]!=b[strlen(b+1)]) now++;
        now+=cnt;
        if((now&1)==0) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    string s;
    cin>>s;
    bool b=true;
    int l=s.length();
    int i=s.find_first_of("QERPSDFGJKLZCBN");

    if(i==0)
        cout<<"NO"<<endl;
    else
    {
        string s1=s;
        reverse(s.begin(),s.end());
        if(s==s1)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    string s;
    cin>>s;
    bool b=true;
    int l=s.length();
    if(l>1)
        for(int i=0 , j=l-1 ; i<l , j>=0 ; i++ , j--)
            {
                if(s[i]!=s[j])
                {
                    cout<<"NO"<<endl;
                    b=false;
                    break;
                }
            }
    else
        {
            cout<<"NO"<<endl;
            b=false;
        }

    if(b==true)
        cout<<"YES"<<endl;

    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    string s;
    cin>>s;
    bool b=true;
    int l=s.length();
    unsigned int found = s.find_first_of("BCDNEFGJKLPQRSZ");
    if(found != string::npos)
        cout<<"NO"<<endl;
    else
    {
        string s1=s;
        reverse(s.begin(),s.end());
        if(s==s1)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}


#include<stdio.h>
#include<string.h>

char a[100005];

int main(){
	scanf("%s",a);
	int l=strlen(a);
	int i,j;
	bool f=true;
	for(i=0,j=l-1;i<=j;i++,j--)
		if(a[i]!=a[j])f=false;
		else if(a[i]!='A'&&a[i]!='H'&&a[i]!='I'&&a[i]!='M'&&a[i]!='O'&&a[i]!='T'&&a[i]!='U'&&a[i]!='V'&&a[i]!='W'&&a[i]!='X'&&a[i]!='Y')f=false;
	if(f)printf("YES\n");
	else printf("NO\n");
	return 0;
}


#include<stdio.h>
#include<string.h>
char s[100007];
int main()
{
    while(scanf("%s",s)!=EOF)
    {
        int len=strlen(s),flag=0;
        if(len==1){printf("NO\n");continue;}
        if(len&1)
        {
            for(int i=len/2-1,j=len/2+1;i>=0&&j<len;i--,j++)
                if(s[i]!=s[j]){flag=1;break;}
        }
        else
        {
            for(int i=len/2-1,j=len/2;i>=0&&j<len;i--,j++)
                if(s[i]!=s[j]){flag=1;break;}
        }
        if(flag)printf("NO\n");
        else printf("YES\n");
    }
    return 0;
}


#include <string.h>
#include <cstdio>
#include <cmath>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <map>
#include <utility>

#define ll long long
#define ld long double

using namespace std;
const int N = 1000005;
int arr[N];

bool isP(string s)
{
	if(s.size() == 0 || s.size() == 1)
		return 1;
	else if(s[0] == s[s.size() - 1])
		return isP(s.substr(1, s.size()-2));
	else return 0;
}

int main()
{
	ios_base::sync_with_stdio(true);
	string str;
	cin >> str;
	if(isP(str))
		puts("YES");
	else puts("NO");
	return 0;
}


#include <string.h>
#include <cstdio>
#include <cmath>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <map>
#include <utility>

#define ll long long
#define ld long double

using namespace std;
const int N = 1000005;
char str[N];

bool isP(int st, int fin)
{
	if(fin - st == 0 || st > fin)
		return 1;
	else if(str[st] == str[fin])
		return isP(++st, --fin);
	else return 0;
}

bool M()
{
	char nm[] = {'B', 'C', 'D', 'E', 'F', 'G', 'J', 'K', 'L', 'N', 'P', 'Q', 'R', 'S', 'Z'};

	for(int i = 0; i < 15; ++i)
	{
		for(int j = 0; j < strlen(str); ++j)
			if(str[j] == nm[i])
				return false;
	}
	return true;
}

int main()
{
	ios_base::sync_with_stdio(true);

	cin >> str;
	if(isP(0, strlen(str)-1) && M())
		puts("YES");
	else puts("NO");
	return 0;
}


#include <string.h>
#include <cstdio>
#include <cmath>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <map>
#include <utility>

#define ll long long
#define ld long double

using namespace std;
const int N = 1000005;
char str[N];

bool isP(int st, int fin)
{
	if(fin - st == 0)
		return 1;
	else if(str[st] == str[fin])
		return isP(++st, --fin);
	else return 0;
}

bool M()
{
	char nm[] = {'B', 'C', 'D', 'E', 'F', 'G', 'J', 'K', 'L', 'N', 'P', 'Q', 'R', 'S', 'Z'};

	for(int i = 0; i < 15; ++i)
	{
		for(int j = 0; j < strlen(str); ++j)
			if(str[j] == nm[i])
				return false;
	}
	return true;
}

int main()
{
	ios_base::sync_with_stdio(true);

	cin >> str;
	if(isP(0, strlen(str)-1) && M())
		puts("YES");
	else puts("NO");
	return 0;
}


#include <string.h>
#include <cstdio>
#include <cmath>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <map>
#include <utility>

#define ll long long
#define ld long double

using namespace std;
const int N = 1000005;
int arr[N];

bool isP(string s)
{
	if(s.size() == 0 || s.size() == 1)
		return 1;
	else if(s[0] == s[s.size() - 1])
		return isP(s.substr(1, s.size()-2));
	else return 0;
}

bool M(string s)
{
	string nm[] = {"B", "C", "D", "E", "F", "G", "J", "K", "L", "N", "P", "Q", "R", "S", "Z"};

	for(int i = 0; i < 15; ++i)
	{
		if(s.find(nm[i]) != string::npos)
			return false;
	}
	return true;
}

int main()
{
	ios_base::sync_with_stdio(true);
	string str;
	cin >> str;
	if(isP(str) && M(str))
		puts("YES");
	else puts("NO");
	return 0;
}


#include <string.h>
#include <cstdio>
#include <cmath>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <map>
#include <utility>

#define ll long long
#define ld long double

using namespace std;
const int N = 1000005;
int arr[N];

bool isP(string s)
{
	if(s.size() == 0 || s.size() == 1)
		return 1;
	else if(s[0] == s[s.size() - 1])
		return isP(s.substr(1, s.size()-2));
	else return 0;
}

bool M(string s)
{
	string nm[] = {"B", "C", "D", "E", "F", "G", "J", "K", "L", "N", "P", "Q", "R", "S", "Z"};
	for(int i = 0; i < sizeof(nm)/2; ++i)
	{
		if(s.find(nm[i]) != string::npos)
			return false;
	}
	return true;
}

int main()
{
	ios_base::sync_with_stdio(true);
	string str;
	cin >> str;
	if(isP(str) && M(str))
		puts("YES");
	else puts("NO");
	return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

#define MAX_LENTH 100

int main()
{
    char str1[MAX_LENTH];
    char str2[] = {"WTYUIOHAMVX"},ch;
    int counter = 0;
    int flag = 0;
    cin>>str1;
    while(1)
    {
        ch = getchar();
        if(ch == '\n')
            break;
        for (int j = 0; j < 11; j++)
        {
            if(ch == str2[j])
                flag = 1;
        }
        if(flag == 0)
        {
            cout<<"NO"<<endl;
            return 0;
        }
        str1[counter++] = ch;
    }
    int len1 = counter;
    for (int i = 0; i <= len1/2; i++)
    {
        if(str1[i] != str1[len1 - i - 1])
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}