Buggy python submission (verdict: Time Limit Exceeded):
import itertools
if __name__ == '__main__':
    n=int(input())
    string=input()
    string_set=set(string)
    div=10**9+7
    count=0
    Dict={}
    for i,s in enumerate(string):
        if s not in Dict.keys():
            Dict[s]=1
        else:
            Dict[s] += 1
        count+=1
    if len(string_set)>1:
        for i in range(2,len(string_set)+1):
            for x in itertools.combinations(Dict.keys(),i):
                temp = 1
                for y in x:
                    temp*=Dict[y]
                count+=temp
    print(count%div)

Fixed submission:
if __name__ == '__main__':
    n=int(input())
    string=input()
    string_set=set(string)
    div=10**9+7
    count=1
    for s in string_set:
        count*=string.count(s)+1
    count-=1
    print(count%div)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
if __name__ == '__main__':
    n=int(input())
    string=input()
    string_set=set(string)
    div=10**9+7
    count=0
    Dict={}
    for i,s in enumerate(string):
        if s not in Dict.keys():
            Dict[s]=1
        else:
            Dict[s] += 1
        count+=1
    if len(string_set)>1:
        for i in range(2,len(string_set)+1):
            for x in itertools.combinations(Dict.keys(),i):
                temp = 1
                for y in x:
                    temp*=Dict[y]
                count+=temp
    print(count%div)

Fixed submission:
if __name__ == '__main__':
    n=int(input())
    string=input()
    string_set=set(string)
    div=10**9+7
    count=1
    for s in string_set:
        count*=string.count(s)+1
    count-=1
    print(count%div)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
if __name__ == '__main__':
    n=int(input())
    string=input()
    string=list(string)
    string_set=set(string)
    div=10**9+7
    count=0
    Dict={}
    for i,s in enumerate(string):
        if s not in Dict.keys():
            Dict[s]=1
        else:
            Dict[s] += 1
        count+=1

    if len(string_set)>1:
        for i in range(2,len(string_set)+1):
            for x in itertools.combinations(Dict.keys(),i):
                temp = 1
                for y in x:
                    temp*=Dict[y]
                count+=temp

    print(count%div)

Fixed submission:
if __name__ == '__main__':
    n=int(input())
    string=input()
    string_set=set(string)
    div=10**9+7
    count=1
    for s in string_set:
        count*=string.count(s)+1
    count-=1
    print(count%div)

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

def one_hot(n):
    temp_0=[0]
    temp_1=[1]
    ret=[]
    S=[temp_0,temp_1]
    v=S.pop()
    while len(ret)!=2**n:
        if len(v)==n:
            ret.append(v)
            if len(S)!=0:
                v = S.pop()
        else:
            S.append(v+[0])
            S.append(v+[1])
            v=S.pop()
    return ret

if __name__ == '__main__':
    n=int(input())
    string=input()
    string=list(string)
    div=10**9+7
    count=0
    iteration=one_hot(n)
    for i in iteration:
        temp=[]
        for s,j in zip(string,i):
            if j==1:
                temp.append(s)
        if len(temp)!=0 and len(temp)==len(set(temp)):
            count+=1
    print(count%div)


Fixed submission:
if __name__ == '__main__':
    n=int(input())
    string=input()
    string_set=set(string)
    div=10**9+7
    count=1
    for s in string_set:
        count*=string.count(s)+1
    count-=1
    print(count%div)