Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
from itertools import product
 
N = int(input())
S = input().strip()
dic = Counter(S)
c = dic.most_common()
mod = 10**9 + 7
 
ans = 0
d = []
for x in c:
    if x[1] == 1:
        break
    else:
        d.append(x[1])
b = len(c)-len(d)
 
ls =list(product([0, 1], repeat=len(d)))
 
for x in ls:
    num = 1
    for z, y in zip(d, x):
        if y == 1:
            num = (z*num)%mod
    ans = (ans + num*(2**b))%mod
print(ans-1)

Fixed submission:
from collections import Counter
from itertools import product
 
N = int(input())
S = input().strip()
dic = Counter(S)
mod = 10**9 + 7

ans = 1
for x in dic:
    ans = ans*(dic[x]+1)%mod
print(ans-1)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
from itertools import product

N = int(input())
S = input().strip()
dic = Counter(S)
c = dic.most_common()
mod = 10**9 + 7

ans = 0
d = []
append = d.append
for x in c:
    if x[1] == 1:
        break
    else:
        append(x[1])
b = len(c)-len(d)

ls =list(product([0, 1], repeat=len(d)))

for x in ls:
    num = 1
    for z, y in zip(d, x):
        if y == 1:
            num = (z*num)%mod
    ans = (ans + num*(2**b))%mod
print(ans-1)

Fixed submission:
from collections import Counter
from itertools import product
 
N = int(input())
S = input().strip()
dic = Counter(S)
mod = 10**9 + 7

ans = 1
for x in dic:
    ans = ans*(dic[x]+1)%mod
print(ans-1)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
from itertools import product

N = int(input())
S = input().strip()
dic = Counter(S)
c = dic.most_common()
mod = 10**9 + 7

ans = 0
d = []
for x in c:
    if x[1] == 1:
        break
    else:
        d.append(x[1])
b = len(c)-len(d)

ls =list(product([0, 1], repeat=len(d)))

for x in ls:
    num = 1
    for z, y in zip(d, x):
        if y == 1:
            num = (z*num)%mod
    ans = (ans + num*(2**b))%mod
print(ans-1)

Fixed submission:
from collections import Counter
from itertools import product
 
N = int(input())
S = input().strip()
dic = Counter(S)
mod = 10**9 + 7

ans = 1
for x in dic:
    ans = ans*(dic[x]+1)%mod
print(ans-1)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
from itertools import product

N = int(input())
S = input().strip()
dic = Counter(S)
c = dic.most_common()
mod = 10**9 + 7

ans = 0
d = []
for x in c:
    if x[1] == 1:
        break
    else:
        d.append(x[1])
b = len(c)-len(d)

ls =list(product([0, 1], repeat=len(d)))

for x in ls:
    num = 1
    for z, y in zip(d, x):
        if y == 1:
            num = (z*num)%mod
    ans = (ans + num*(2**b))%mod
print(ans-1)

Fixed submission:
from collections import Counter
from itertools import product
 
N = int(input())
S = input().strip()
dic = Counter(S)
mod = 10**9 + 7

ans = 1
for x in dic:
    ans = ans*(dic[x]+1)%mod
print(ans-1)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
from itertools import product

N = int(input())
S = input().strip()
dic = Counter(S)
mod = 10**9 + 7

ans = []
ls =list(product([0, 1], repeat=len(dic)))
ls.pop(0)

a = []
for i in dic:
    a.append(dic[i])

for x in ls:
    num = 1
    for z, y in zip(a, x):
        if y == 1:
            num = (z*num)%mod
    ans.append(num)
print(sum(ans)%mod)

Fixed submission:
from collections import Counter
from itertools import product
 
N = int(input())
S = input().strip()
dic = Counter(S)
mod = 10**9 + 7

ans = 1
for x in dic:
    ans = ans*(dic[x]+1)%mod
print(ans-1)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
from itertools import product

N = int(input())
S = input().strip()
dic = Counter(S)
mod = 10**9 + 7

ans = 0
ls =list(product([0, 1], repeat=len(dic)))
ls.pop(0)

a = []
for i in dic:
    a.append(dic[i])

for x in ls:
    num = 1
    for z, y in zip(a, x):
        if y == 1:
            num = (z*num)%mod
    ans = (ans+num)%mod
print(ans)

Fixed submission:
from collections import Counter
from itertools import product
 
N = int(input())
S = input().strip()
dic = Counter(S)
mod = 10**9 + 7

ans = 1
for x in dic:
    ans = ans*(dic[x]+1)%mod
print(ans-1)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
from itertools import product

N = int(input())
S = input().strip()
dic = Counter(S)
mod = 10**9 + 7

ans = 0
ls =list(product([0, 1], repeat=len(dic)))
ls.pop(0)

for x in ls:
    num = 1
    for z, y in zip(dic, x):
        if y == 1:
            num = (dic[z]*num)%mod
    ans = (ans+num)%mod
print(ans)

Fixed submission:
from collections import Counter
from itertools import product
 
N = int(input())
S = input().strip()
dic = Counter(S)
mod = 10**9 + 7

ans = 1
for x in dic:
    ans = ans*(dic[x]+1)%mod
print(ans-1)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
from itertools import product

N = int(input())
S = input().strip()
dic = Counter(S)
mod = 10**9 + 7

ans = 0
ls =list(product([0, 1], repeat=len(dic)))
ls.pop(0)

for x in ls:
    num = 1
    for z, y in zip(dic, x):
        if y == 1:
            num = dic[z]*num
            num = num%mod
    ans += num
    ans = ans%mod
print(ans)

Fixed submission:
from collections import Counter
from itertools import product
 
N = int(input())
S = input().strip()
dic = Counter(S)
mod = 10**9 + 7

ans = 1
for x in dic:
    ans = ans*(dic[x]+1)%mod
print(ans-1)