Problem:
 Score : 200 points    Problem Statement You are given a string S of length N .
Among its subsequences, count the ones such that all characters are different, modulo 10^9+7 . Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings.  Here, a subsequence of a string is a concatenation of one or more characters from the string without changing the order.      Constraints  1 \leq N \leq 100000  S consists of lowercase English letters.  |S|=N         Input Input is given from Standard Input in the following format:  N  S       Output Print the number of the subsequences such that all characters are different, modulo 10^9+7 .        Sample Input 1 4
abcd      Sample Output 1 15  Since all characters in S itself are different, all its subsequences satisfy the condition.       Sample Input 2 3
baa      Sample Output 2 5  The answer is five: b , two occurrences of a , two occurrences of ba . Note that we do not count baa , since it contains two a s.       Sample Input 3 5
abcab      Sample Output 3 17

Solution (Python):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
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 LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


N = I()
s = S()

inf = 10**9+7

counts = collections.Counter(s)
result = 1
for i in counts.values():
    result *= i+1
result -= 1
print(result%inf)
exit()

Solution (Python):

import sys
import numpy as np

MOD = 1000000007  


def solve(N: int, S: str):
    abc = "abcdefghijklmnopqrstuvwxyz"
    
    
    
    
    
    
    
    
    
    
    

    seki = 1
    for c in abc:
        seki *= 1+S.count(c)
    print((seki-1) % MOD)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    S = next(tokens)  
    solve(N, S)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
s = input()
MOD = 10 ** 9 + 7
a = ord('a')
rec = [0] * 26
for i in range(n):
    rec[ord(s[i]) - a] += 1

num = 1
for i in range(26):
    if rec[i] != 0:
        num *= rec[i] + 1
        num %= MOD

print(num - 1)

Solution (Python):
N = int(input())
S = input()

ans = 1
for c in [chr(x) for x in range(97, 97 + 26)]:
    ans *= S.count(c) + 1
print((ans - 1) % (pow(10, 9) + 7))

Solution (Python):
n = int(input())
s = input()
check = {}
for i in "abcdefghijklmnopqrstuvwxyz":
    check[i] = 0
ans = 1
for i in range(n):
    check[s[i]] += 1
for i in "abcdefghijklmnopqrstuvwxyz":
    ans *= check[i]+1
ans = (ans-1)%1000000007
print(ans)

Solution (Python):
N = int(input())
S = input()

mod = 10**9 + 7
alphabet = [chr(i) for i in range(97,97+26)]

ans = 1
for letter in alphabet:
    ans *= S.count(letter) + 1
    ans =  ans%mod
ans -= 1

print(ans)

Solution (Python):
from collections import Counter
from functools import reduce
 
def counter(list_1):
	return ((reduce(lambda a,b:a*b,map(lambda x:x+1,list_1))-1)%(10**9+7))
  
N=input()
S=input()
answer=counter(Counter(S).values())
print(answer)

Solution (Python):
import operator as op
from collections import Counter
from functools import reduce, partial

add1 = partial(op.add, 1)

def count(counts):
    return reduce(op.mul, map(add1, counts)) - 1


N = int(input())
S = input()
print(count(Counter(S).values())%(10**9+7))

Solution (Python):
def a_colorful_subsequence(N, S):
    from collections import Counter
    from functools import reduce
    from operator import mul
    return (reduce(mul, map(lambda x: x + 1, Counter(S).values())) - 1) % (10**9 + 7)

N = int(input())
S = input()
print(a_colorful_subsequence(N, S))

Solution (Python):
counter = 1
N = int(input())
S = input()

n = 10**9 + 7
for i in set(S):
    counter = counter * (S.count(i)+1) % n

print(counter-1)

Solution (Python):
from collections import Counter

n = int(input())
s = list(input())

c = Counter(s)

ans = 1

for x in c.values():
    ans *= (x + 1)

print((ans - 1) % (10 ** 9 + 7))

Solution (Python):
n=input()
s=input()
ret=1
for i in range(97, 97+26):
  x=s.count(chr(i))
  ret*=x+1
  ret%=1000000007
print((ret-1)%1000000007)

Solution (Python):
N = int(input())
S = input()

mod = 10**9+7
cnt = 1
setS = set(S)
for s in setS:
  cnt *= S.count(s)+1
print((cnt-1)%mod)

Solution (Python):
from sys import stdin
import math
import itertools


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


"""
temp_ans = []


def problem_a(input_string):
    S = int(input_string[0].rstrip())
    N = input_string[1].rstrip()
    N_l = len(N)
    global temp_ans
    for i in range(N_l)[::-1]:
        temp_ans += N[i]
        
        for s in temp_ans:
            
            if N[i] not in s:
                temp_ans.append(N[i]+s)
    
    return len(temp_ans) % (10**9 + 7)
"""


def problem_a(input_string):
    S = int(input_string[0].rstrip())
    N = input_string[1].rstrip()
    
    dic = {}
    c = 0
    for i in range(S)[::-1]:
        if N[i] not in dic:
            dic[N[i]] = 1
            
        else:
            dic[N[i]] += 1

    c = 1
    for key, value in dic.items():
        c *= (value+1)
    c -= 1
    """
    c += 2**len(dic.keys())-1
    
    
    for key, value in dic.items():
        if value > 1:
            
            c += 2**(len(dic.keys()))-1
            
    
    for key, value in dic.items():
        if value > 1:
            if len(dic.keys()) != S:
                c -= 2**(S-len(dic.keys())-1)
    """
            
        
    
    """
    s_N = sorted(N)
    for i in range(S-1):
        if s_N[i] != s_N[i+1]:
            c += 2**(i+2)
    """
    """
    for key, value in dic.items():
        if value > 1:
            c += 2**(len(dic.items())-value)
        else:
            c += 2**(len(dic.items())-value)
    """
    

    return c % (10**9 + 7)


def main():
    input_line = stdin.readlines()
    answer = problem_a(input_line)
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
S=list(map(lambda x: ord(x),input()))
MOD = 10**9 + 7 




AppearCount = [ 0 for _ in range(26)]

for n in range(N):
	AppearCount[S[n]-ord('a')] += 1

ans = 1
bFirst = True

for a in AppearCount:
	if a != 0:
		ans *= (a+1)
		while MOD < ans:
			ans -= MOD

ans -= 1

while MOD <= ans:
	ans -= MOD

print(ans)

Solution (Python):
from collections import Counter

n = int(input())
s = str(input())
c = Counter(s)

ans = 1
for v in c.values():
    ans *= (v + 1)
ans -= 1
print(ans%(10**9+7))

Solution (Python):

from functools import reduce
from collections import Counter

MOD = 10**9 + 7
N = int(input())
S = input()

print(
    reduce(lambda x, y: (x * y) % MOD,
           map(lambda x: x + 1,
               Counter(list(S)).values())) - 1)

Solution (Python):
N=int(input())
S=list(input())
import collections
L=collections.Counter(S).values()
A=1
mod=10**9+7
for i in L:
  A*=(i+1)
print((A-1)%mod)

Solution (Python):
N=int(input())
S=list(input())
import collections
L=collections.Counter(S).values()
A=1
mod=10**9+7
for i in L:
  A*=(i+1)
  A=A%mod
print((A-1)%mod)

Solution (Python):
N = int(input())
S = input()
l = [1 for i in range(26)]

for s in S:
    l[ord(s) - ord('a')] += 1

ans = 1
for i in l:
    ans *= i

ans = (ans - 1) % (10 ** 9 + 7)

print(ans)

Solution (Python):
N = int(input())
S = input()
ans = 1
MOD = 10**9 + 7
for s in set(S):
    ans *= S.count(s) + 1
print((ans - 1) % MOD)

Solution (Python):


import sys
from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n = II()
    s = SI()

    C = Counter(s)
    res = 1
    for c in C.values():
        res *= c + 1
        res %= MOD

    return res - 1 if res else MOD - 1


print(main())

Solution (Python):


import sys
from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n = II()
    s = SI()

    cnt = [0] * 27
    res = 0
    for c in s:
        k = ord(c) - 97
        cnt[k] += 1
        tmp = 1
        for i in range(27):
            if not cnt[i]:
                continue
            if i == k:
                continue
            tmp *= cnt[i] + 1
        res += tmp
        res %= MOD

    return res if res else MOD


print(main())

Solution (Python):
n=int(input())
s=input()
m=10**9+7
cnt=[0]*26
for i in s:
    cnt[ord(i)-97]+=1
ans=1
for i in range(26):
    ans*=cnt[i]+1
    ans%=m
print(ans-1)

Solution (Python):
def main():
    N = int(input())
    S = input()
    ans = {}
    for s in range(ord('a'),ord('z')+1):
        ans[chr(s)] = 0
    for s in S:
        if not ans[s]:
            ans[s] = 1
        else:
            ans[s] += 1
    res = 1
    for _, v in ans.items():
        res *= v+1
    return res - 1


if __name__ == '__main__':
    print(main() % (10**9+7))

Solution (Python):
def main():
    N = int(input())
    S = input()

    str_list = list()
    for s in S:
        str_list.append(s)

    str_uni_list = {}
    for str in str_list:
        if (str in str_uni_list) is False:
            str_uni_list[str] = 1
        else:
            str_uni_list[str] += 1

    list_val = []
    for i in str_uni_list.values():
        list_val.append(i)

    rem = 1
    for v in list_val:
        rem *= (v + 1)

    ans = rem - 1

    print(ans % (10 ** 9 + 7))


if __name__ == '__main__':
    main()

Solution (Python):
from collections import defaultdict

MOD = 10 ** 9 + 7

N = int(input())
s = input()

d = defaultdict(int)
for ss in s:
    d[ss] += 1

ans = 1
for k, v in d.items():
    ans *= (v + 1)
    ans %= MOD
    
ans -= 1
print(ans)

Solution (Python):
N=int(input())
S=input()
d={}
for c in S:
	d[c] = d[c]+1 if d.__contains__(c) else 1
mod=int(1e9+7)
ans=1
for a,b in d.items():
	ans= ans*(b+1)%mod

print(ans-1)

Solution (Python):
input()
s=input()
a=1
for t in map(s.count,set(s)):a*=-~t
print(a%(10**9+7)-1)

Solution (Python):
n=int(input())
s=input()
d={}
for i in range(n):
    if s[i] in d.keys():
        d[s[i]]+=1
    else:
        d[s[i]]=1
w=1
for i in d.values():
    w*=(i+1)
    w=w%(1e9+7)
    
    
    
    
if w==0:
    print(1e9+6)
else:
    print(int(w-1))

Solution (Python):


import sys

def parse_input(lines_as_string = None):


    lines = []
    if lines_as_string is None:
        lines.append(input())
        lines.append(input())
    else:
        lines = [e for e in lines_as_string.split("\n")][1:-1]
 
    tokens = lines[0].split(" ")
    n = int(tokens[0])
    tokens = lines[1].split(" ")
    s = tokens[0]

    return (n, s)


def solve(n, s):

    d = dict([(c, 0) for c in "abcdefghijklmnopqrstuvwxyz"])

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

    count = 1
    for v in [v for v in d.values() if v > 0]:
        count = count * (v+1)
    

    return (count - 1) %(10**9+7)

def main():
    

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

Solution (Python):
N=int(input())
S=input()
iD = 10**9+7
aT={}
for s in S:
    if s in aT:
        aT[s]+=1
    else:
        aT[s]=1
iT = 1
for s in aT:
    iT *= aT[s]+1
print((iT - 1)%iD)

Solution (Python):
from collections import defaultdict

n = input()
S = input()
p = 10 ** 9 + 7
D = defaultdict(int)

for s in S:
    D[s] += 1

ans = 1
for k, v in D.items():
    ans *= (v + 1)
    ans %= p

print(ans - 1)

Solution (Python):
N = int(input())
S = input()
d = {}
mod = 10**9 + 7
for key in S:
    if key in d:
        d[key] += 1
    else:
        d[key] = 1
ans = 1
for x in d.values():
    ans *= x+1
print(ans % mod -1)

Solution (Python):
n=int(input())
s=list(input())
mod=10**9+7
z=list(set(s))
ans=1

m=len(z)
for i in range(m):   
    ans*=(s.count(z[i])+1)%mod
    ans=ans%mod
print((ans-1)%mod)

Solution (Python):
for t in range(1):
	n=input()
	s=input()
	freq=[0]*(26)
	ct=0
	for i in range(len(s)):
		freq[ord(s[i])-ord('a')]+=1
		if freq[ord(s[i])-ord('a')]==1:
			ct+=1
	ans=1
	for i in range(26):
		if freq[i]>0:
			ans=(ans*(freq[i]+1))
	print((ans-1)%1000000007)

Solution (Python):
MOD = 10**9+7

N = int(input())
S = input().strip()


nums = dict()
for c in S:
    if c in nums: nums[c] += 1
    else: nums[c] = 1  



res = 1
for _, v in nums.items():
    res = res * (v+1) % MOD

res -= 1
print(res)

Solution (Python):




def main():
    N = int(input())
    S = input()

    cnt = [0] * 26
    for i in S:
        cnt[ord(i)-ord('a')] += 1

    ans = 1
    MOD = 10 ** 9 + 7
    for i in range(26):
        ans = ans * (cnt[i]+1) % MOD

    print(ans-1)


if __name__ == '__main__':
    main()

Solution (Python):
from functools import reduce
from string import ascii_lowercase
n = int(input())
s = input()
cnt = [s.count(c) + 1 for c in ascii_lowercase]
print(reduce(lambda x, y: x * y % (10 ** 9 + 7), cnt) - 1)

Solution (Python):



N = int(input())

S = input()

ans = 1
tmp = 0
cnt = [0]*26
for s in S:
    cnt[ord(s)-ord('a')] += 1
    
for c in cnt:
    if c != 0:
        ans *= (c+1)
        ans %= 10**9+7
    
        
print(ans-1)

Solution (Python):
N = int(input())
S = input()
M = 10**9+7

cnt = {}
for i in S:
    if i in cnt.keys():
        cnt[i] += 1
    else:
        cnt[i] = 1

ans = 1
for l in cnt.values():
    ans *= l + 1

print((ans-1)%M)

Solution (Python):
N = int(input())
S = input()
d = {}
MOD = 10 ** 9 + 7
for key in S:
    if key in d:
        d[key] += 1 
    else:
        d[key] = 1 
ans = 1
for v in d.values():
    ans *= v+1
    ans %= MOD
print(ans - 1)

Solution (Python):
input()
S=input()
L=list("abcdefghijklmnopqrstuvwxyz")
C=[1]*26
for s in S:
    C[L.index(s)]+=1
ans=1
for c in C:
    ans=(ans*c)%(10**9+7)
print(ans-1)

Solution (Python):
n=int(input())
s=input()
l=[1 for i in range(26)]
L=[chr(i) for i in range(97,97+26)]
for j in range(len(s)):
  l[L.index(s[j])]+=1
ans=1
for k in range(26):
  ans*=l[k]
  ans%=(10**9+7)
print(ans-1)

Solution (Python):
n=int(input())
s=input()
f=[0]*(26)
for i in s:
	f[ord(i)-ord('a')]+=1
ans=1
for i in range(26):
	ans=(ans*(f[i]+1))%1000000007
print(ans-1)

Solution (Python):
N = int(input())
S = input()
v = [0] * 26
for i in range(0, N):
    v[ord(S[i]) - 97] += 1
wa = 1

for i in range(len(v)):
    wa *= (v[i] + 1)
print((wa - 1) % (10 ** 9 + 7))

Solution (Python):
from collections import defaultdict, Counter


def readln():
    return list(map(int, input().split()))


N = readln()[0]
S = input()
mod = 10**9+7

dic = Counter(S)

ans = 1
for count in dic.values():
    
    ans *= (count + 1)
    ans %= mod


print(ans-1)

Solution (Python):
N=int(input())
S=input()
cnt=1
n = 10**9 + 7
for i in set(S):
    cnt*=(S.count(i)+1)
    cnt=cnt%n
 
print(cnt-1)

Solution (Python):
from collections import*
n=int(input())
ans=1
for i in Counter(input()).values():
    ans*=(i+1)
print((ans-1)%(10**9+7))

Solution (Python):
N = input()
S = input()
mod = 1000000007

d = {}
for c in S:
    if not c in d:
        d[c] = 1
    else:
        d[c] += 1

c = 1
for i in d.values():
    c *= (i+1)

print((c-1)%mod)

Solution (Python):
P=10**9+7
N=int(input())
S=input()
dict={}

for s in set(S):
    dict[s]=S.count(s)+1

ans=1

for d in dict.values():
  ans=(ans*d)%P
  
print(ans-1)

Solution (Python):
from collections import Counter
N = int( input())
S = input()
Q = 10**9+7
C = Counter(S)
ans = 1
for c in C:
    ans *= C[c]+1
    ans %= Q
print((ans-1)%Q)

Solution (Python):
n = int(input())
S = list(input())
dic = {}

for d in S:
    if d not in dic:
        dic[d] = 1
    else:
        dic[d] += 1
tot = 1
for d in dic:
    i = dic[d] + 1
    tot = tot*i % (10**9 + 7)

print((tot-1) % (10**9+7))

Solution (Python):
import sys,itertools
input = sys.stdin.readline
N = int(input().strip())
S = input().strip()

le = [S.count(s)+1 for s in set(S)]
cnt=1
for i in le:
    cnt*=i
print((cnt-1)%((10**9)+7))

Solution (Python):

import collections
N=int(input())
S=str(input())
Slist=list(S)
c = collections.Counter(Slist)
d = c.most_common()
dlen=len(d)
count=1
for i in range(dlen):
    count*=(d[i][1]+1)
count-=1
count%=1000000007
print(count)

Solution (Python):
N = int(input())
S = input()

mod = 10 ** 9 + 7

kind = set(S)
each_char = []

for char in kind:
    each_char.append(S.count(char))

count = 1
for i in each_char:
    count = (count % mod) * ((i + 1) % mod) % mod

print((count - 1) % mod)

Solution (Python):
N = int( input())
S = input()
Q = 10**9+7
A = [1]*26
ANS = [0]*26
for i in range(N):
    s = ord(S[i]) - ord("a")
    ans = 1
    for j in range(26):
        if j != s:
            ans *= A[j]
            ans %= Q
    ANS[j] = (ANS[j] + ans)%Q
    A[s] += 1
print( sum(ANS))

Solution (Python):
from collections import defaultdict


def readln():
    return list(map(int, input().split()))


N = readln()[0]
S = input()
mod = 10**9+7

dic = defaultdict(lambda: 0)
for s in S:
    dic[s] += 1
ans = 1
for count in dic.values():
    
    ans *= (count + 1)
    ans %= mod


print(ans-1)

Solution (Python):
import math
import copy
from collections import Counter
 
 
 
def nCast(number):
    if type(number)==str:
        return int(number)
    for idx in range(0,len(number)):
        if type(number[idx])==str:
 
            number[idx]=int(number[idx])
        else:
            nCast(number[idx])
    return number
    
def inputArr(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l
def inputArr1(w):
    l=list()
    for idx in range(0,w):
        l.append(input().split())
    return l
 

n=input()
s=input()

mod=7+10**9


def func():

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

Solution (Python):

input();s=input()
a,*b=map(s.count,set(s));a+=1
for t in b:a=-~t*a%(10**9+7)
print(a-1)

Solution (Python):
N=list(range(int(input())))
S=list(input())
S=sorted(S)
answer=0

prev=S[0]
counts = []
counter=0

for k in S:
    if k==prev:
        counter+=1
    else:
        prev=k
        if counter!=0:
            counts.append(1+counter)
        counter=1
if counter!=0:
    counts.append(1+counter)

def soujou(li):
    atai=1
    for j in li:
        atai=j*atai
    return atai

answer=soujou(counts)-1
print(answer%(7+10**9))

Solution (Python):
import collections
N = int(input())
S = input()

result = 1
route = [x+1 for _,x in collections.Counter(S).items()]
for x in route:
    result = result*x
print((result-1)%(10**9+7))

Solution (Python):
n = int(input())
s = input()
MOD = 10**9+7

from collections import defaultdict
import string
d = defaultdict(int)
let = string.ascii_lowercase

for ele in s:
  d[ele] += 1

ans = 1
for i in range(26):
  if d[let[i]]>0:
    ans = (ans * (d[let[i]]+1))%MOD
print(ans-1)

Solution (Python):
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)

Solution (Python):
input();s=input()
a,*b=[s.count(i)+1for i in set(s)]
for t in b:a=t*a%(10**9+7)
print(a-1)

Solution (Python):
mod = 10**9 + 7

n = int(raw_input())
s = raw_input()

q = []

for a in "abcdefghijklmnopqrstuvwxyz":
  q.append( s.count(a) )

ans = 1

for a in q:
  ans *= (a+1)
  ans %= mod

print ans-1

Solution (Python):
input();s=input()
a,*b=[s.count(i)+1for i in set(s)]
for t in b:a=t*a%(10**9+7)
print(a-1)

Solution (Python):
N = int(input())
S = input()

char = []
num = 1
while(len(S) > 0):
    num = num * (S.count(S[0]) + 1)

    S = S.replace(S[0], "")

num = num - 1
print(num % 1000000007)

Solution (Python):
N = int(input())
S = input()
a = 1
for c in [chr(i) for i in range(97, 123)]:
    a = (a * (S.count(c) + 1)) % (1e9 + 7)
print(int((a - 1) % (1e9 + 7)))

Solution (Python):
n = int(input())
s = input()
cnt = [0] * 26
for c in s:
    cnt[ord(c) - ord('a')] += 1
res = 1
for i in cnt:
        res *= i + 1
print((res - 1) % (10 ** 9 + 7))

Solution (Python):
from collections import defaultdict


def readln():
    return list(map(int, input().split()))


N = readln()[0]
S = input()
mod = 10**9+7

dic = defaultdict(lambda: 0)
for s in S:
    dic[s] += 1
ans = 1
for count in dic.values():
    
    ans *= (count + 1)


print((ans-1) % mod)

Solution (Python):
import collections

n = int(input())
s = input()
cnt = 0
dictionary = {}

for i in range(n)[::-1]:
  if s[i] in dictionary.keys():
    dictionary[s[i]] += 1
  else:
    dictionary[s[i]] = 1
  ch = s[i:]
  tmp_cnt = 1
  for k,v in dictionary.items():
    if k != s[i]:
      tmp_cnt *= (v+1)
  cnt += tmp_cnt % (10**9+7)
print(cnt % (10**9+7))

Solution (Python):
from collections import defaultdict


def readln():
    return list(map(int, input().split()))


N = readln()[0]
S = input()


dic = defaultdict(lambda: 0)
for s in S:
    dic[s] += 1
ans = 1
for count in dic.values():
    
    ans *= count + 1


print((ans-1) % (10**9+7))

Solution (Python):
from collections import Counter

n = int(input())
s = input()

cnt = Counter(list(s))
num = 1
for i in cnt.values():
    num = num * (i+1)

out = (num - 1) % int(1e09 + 7)
print(out)

Solution (Python):
from collections import Counter
 
n = int(input())
s = input()
cnt = Counter(s)
ans = 1
MOD = 10 ** 9 + 7
for c, v in cnt.items():
    ans = ans * (v + 1) % MOD
print(ans - 1)

Solution (Python):
n=int(input())
s=list(input())
d=[1]*26
g=ord("a")
for i in range(n):
    d[ord(s[i])-g]+=1
p=1
for i in range(26):
    if d[i]!=0:
        p*=d[i]
else:
    print((p-1)%(10**9+7))

Solution (Python):
import collections

N = int(input())
S = list(input())

c = collections.Counter(S)
v = c.values()
count = 1
for v in c.values():
    count *= (v+1)
print((count-1)%(10**9+7))

Solution (Python):
n = int(input()) 
s = input() 

x="abcdefghijklmnopqrstuvwxyz"
MOD = 1000000007

counter = list([])
for c in x:
    l = s.count(c)
    if l != 0:
        counter.append(l)

ans = 1
for i in counter:
    ans *= (i+1)
    ans %= MOD
ans -= 1

print(ans)

Solution (Python):
from itertools import combinations
N = int(input())
S = list(input().strip())
d = {}
for c in S:
  if c in d.keys():
    d[c] += 1
  else:
    d[c] = 1
ans = 0
for n in d.values():
  ans = (ans+n+ans*n)%(10**9+7)
print(ans)

Solution (Python):
N = int(input())
S = input()        

tmp = []
for a in "abcdefghijklmnopqrstuvwxyz":      
    tmp.append(S.count(a)+1)
    
ans = 1 
for i in tmp:
    ans = ans * i % (10**9+7)
    
print(ans-1)

Solution (Python):
import collections
N=input()
S=raw_input()

C=collections.Counter(S)

ans=1
for item, cnt in C.items():
	ans*=(cnt+1)

print (ans-1)%(10**9+7)

Solution (Python):
N = int(input())
S = input()

ans = 1
while len(S) > 0:
  n = S.count(S[0])
  ans *= n + 1
  S = S.replace(S[0], "")

print((ans - 1) % (10 ** 9 + 7))

Solution (Python):
import numpy as np

N = int(input())
S = input()
alpha = np.zeros(52)
Alp = [chr(i) for i in range(97, 97+52)]
for s in S:
  alpha[Alp.index(s)] += 1
alpha = alpha[np.nonzero(alpha)]
def func(alpha):
  Size = alpha.shape[0]
  ans = 0
  if Size>1:
    size=int(Size/2)
    m_ans = func(alpha[:size])
    u_ans = func(alpha[size:])
    ans = (m_ans+1)*(u_ans+1)-1
  else:
    ans = alpha[0]
  return int(ans)

print(func(alpha)%(10**9+7))

Solution (Python):
n=int(input())
s=input()
d={}
for i in range(n):
    if s[i] in list(d.keys()):
        d[s[i]]+=1
    else:
        d[s[i]]=1
w=1
for i in list(d.values()):
    w*=(i+1)
    w=w%(1e9+7)
if w==0:
    print(1e9+6)
else:
    print(int(w-1))

Solution (Python):
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    n = int(input())
    s = input().rstrip()
    eng_list = 'abcdefghigklmnopqrstuvwxyz'
    eng_dict = {}
    for i in eng_list:
        eng_dict[i] = 1
    for i in s:
        try:
            eng_dict[i] += 1
        except KeyError:
            eng_dict[i] = 2
    ans = 1
    size = 10**9+7
    for i in eng_dict.values():
        ans = (ans*i)%size
    print((ans-1)%size)

Solution (Python):


def main(S):
    counter = {}
    for c in S:
        cnt = counter.setdefault(c, 1)
        counter[c] = cnt + 1
    
    n = 1
    for v in counter.values():
        n = (n * v) % 1000000007
        
    return n-1

def test(S, e):
    import sys
    if main(S) != e:
        print("expected", e, "but", main(S))
        sys.exit(1)

test("abcd", 15)
test("baa", 5)
test("abcab", 17)
input()
S = input()
print(main(S))

Solution (Python):
import collections
M = pow(10, 9) + 7
input()
s = input().strip()
r=1
for x in collections.Counter(s).values():
    r = (r*(x+1)) %M
print(r-1)

Solution (Python):
mod = 1000000007
n = int(input())
s = input()
abets ="abcdefghijklmnopqrstuvwxyz"
counts = []
for c in abets:
  counts.append(s.count(c))
ans = 0
for cnt in counts:
  if cnt != 0:
    ans = (ans + ans*cnt + cnt) % mod
print(ans)

Solution (Python):
from collections import defaultdict
import bisect as bs
MOD = 10**9 + 7
L = int(input())
S = input()
dic, l_dic = defaultdict(list), {}
for i in range(L):
    dic[S[i]].append(i)
ans = 0
for key in dic:
    l_dic[key] = len(dic[key])
for i in range(L):
    sub = 1
    for key in dic:
        if key == S[i]:
            continue
        sub = sub * (l_dic[key] - bs.bisect_right(dic[key], i) + 1) % MOD
    ans = (ans + sub) % MOD
print(int(ans))

Solution (Python):
counter = 1
N = int(input())
S = input()

n = 10**9 + 7
for i in set(S):
    counter *= (S.count(i)+1)
    counter = counter % n
 
print(counter-1)

Solution (Python):

 
n = int(input())
s = input()
LetterCount = {i:s.count(i) for i in 'abcdefghijklmnopqrstuvwxyz'}
answer = 1
for i in 'abcdefghijklmnopqrstuvwxyz':
  answer = answer * (LetterCount[i]+1) % (10**9+7)
print(answer-1)

Solution (Python):
import collections as c
ip = lambda : map(int, input().split())


N = int(input())
S = input()

count = c.Counter(S)
res = 1
for i in count:
    res = res%(1e9+7)*(count[i]+1)
res -= 1

print(int(res%(1e9+7)))

Solution (Python):
N = int(input())
S = input()
alphabets = {}
ans = 0
mod = 10**9+7
for i in range(N):
    if not S[i] in alphabets:
        alphabets[S[i]] = 0
    alphabets[S[i]] += 1

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

Solution (Python):
from collections import Counter
def solve(N, S):
    d = 10**9 + 7
    c = Counter(S)
    ans = 1
    for ch, count in c.items():
        ans *= (count + 1)
    ans %= d
    return ans - 1

if __name__ == "__main__":
    N = int(input())
    S = input()
    print(solve(N, S))

Solution (Python):
_=input()
s=input()
mod=7+10**9
ans=1
for i in range(26):
    ans*=1+s.count(chr(ord('a') + i))
    ans%=mod
print(ans-1)

Solution (Python):
n=input()
s=list(input())
    
num_s=[]
s_sub=list(set(s))
sum=1
for i in range(len(s_sub)):
    num_s.append(s.count(s_sub[i]))
    sum*=(num_s[i]+1)
    
print((sum-1)%(10**9+7))

Solution (Python):
import collections
import functools
import operator
N = int(input())
S = str(input())
c = collections.Counter(S)
count = c.most_common()
count = [x+1 for _, x in count]
count = functools.reduce(operator.mul, count) -1
print(int(count%(10**9+7)))

Solution (Python):
from collections import Counter

mod = 1000000007

N = int(input())
S = input()
c = Counter()
ans = 0
for i in range(N):
    ans += ans // (c[S[i]] + 1) + 1
    
    c[S[i]] += 1
print(ans % mod)

Solution (Python):
n=int(input())
s=input()
c=[0]*26
x=10**9+7

ans=0
for chr in range(n):
    c[ord(s[chr])-97]+=1
for i in range(26):
    ans=((ans%x)*((c[i]+1)%x))%x
    ans+=c[i]
    ans%=x
print(ans)

Solution (Python):
def f(S):
    source_str = 'abcdefghijklmnopqrstuvwxyz'
    a = [0] * len(source_str)
    for i in range(len(a)):
        a[i] = S.count(source_str[i])
    
    n = 1
    for i in range(len(a)):
        n *= (a[i] + 1)


    return n

def g(S):
    fs = f(S)
    N = int(1e9) + 7
    return (fs + N - 1) % N




N = int(input())
S = input()

print(g(S))

Solution (Python):
N = int(input())
S = input()
count = [0] * 26
for c in S:
    count[ord(c) - ord('a')] += 1
seq = 1
for c in count:
    if c != 0:
        seq *= (c + 1)
seq -= 1
print(seq % 1000000007)

Solution (Python):
n=int(input())
s=input()
k=list(set(s))
d = {i: s.count(i) for i in k}
counta=0

for i in k:
    counta=counta*d[i]+d[i]+counta


print(counta%(10**9+7))

Solution (Python):
l = int(input())
s = input()
s_dict = {}
l = len(s)
for i in range(l):
    if not s[i] in s_dict:
        s_dict[s[i]] = 1
    else:
        s_dict[s[i]] += 1
ans = 1
for v in s_dict.values():
    if v == 1:
    	ans *= 2
    else:
        ans *= v+1

print(int(ans-1)%(10**9+7))

Solution (Python):
N = int(input())
S = input()
count = [0]*26
for ch in S:
    count[ord(ch)-ord('a')] += 1
ans = 1
for i in count:
    if i != 0:
        ans *= i+1
print((ans-1)%(10**9+7))

Solution (Python):
N = int(input())
S = input()

MOD = 1e9 + 7
L = {}
for i in S:
  if i in L:
    L[i] += 1
  else:
    L[i] = 1

Ans = 1
for i in L.values():
  Ans = Ans * (i + 1) % MOD

Ans -= 1
if Ans < 0:
  Ans += MOD

print(int(Ans))

Solution (Python):
N=int(input())
S=input()
R=""
L=[]
obj={}
for s in S:
    if s not in L:
        R+=s
        L.append(s)
        obj[s]=1
    else:
        obj[s]+=1

out=1
for a in obj.keys():
    out*=(obj[a]+1)
    if out>10**9+7:
        out=out%(10**9+7)
print(out-1)

Solution (Python):
from collections import Counter
N=int(input())
S=input()
l=list(S)
c=Counter(l)
l=c.most_common()
count=1
least=0
bin=[]
for i in range(len(l)):
    if l[i][1]>1:
        
        bin.append(1)
        count=count*(l[i][1]+1)

    else:
        least+=1
count=count*2**least
ans=count-1
ans=ans%(10**9+7)
print(ans)

Solution (Python):
N = input() 
S = input()

a = {}

for i in range(len(S)):
    m = S[i]
    if m in a:
        a[m] += 1
    else:
        a[m] = 1

n = 1
for i in a.values():
    n = n * (i + 1)
n -= 1

print(n % 1000000007)

Solution (Python):
N = int(input())
S = input()
A = 'abcdefghijklmnopqrstuvwxyz'
X = []
for var in A:
    X.append(S.count(var))
Y = X[0]

for i in range(1,26):  
    temp=1  
    for k in range(i+1):
        if k ==0:
            temp*=X[i]
        else:
            temp*=(X[i-k]+1)        
    Y+=temp
print(Y%(10**9+7))

Solution (Python):
import collections
n = int(input())
s = input()
c = collections.Counter(list(s))
a = list(c.values())
count = 0
r = 1
for i in range(len(a)):
    if a[i] == 1:
        count += 1
    else:
        r *= (a[i] + 1)

print((2 ** count * r - 1) % (10 ** 9 + 7))

Solution (Python):
import collections

N = int(input())
S = list(input())

lst = [0] * 26
for i in range(N):
    lst[ord(S[i]) - 97] += 1

for i in range(len(lst)):
    if i == 0:
        pass
    else:
        lst[i] += lst[i] * sum(lst[:i])

ans = sum(lst)
    
print(ans % (10**9 + 7))

Solution (Python):
N = int(input())
S = input()
D = 10**9+7

d = {}
for i,n in enumerate(S):
    if n in d.keys():
        d[n] += 1
    else:
        d[n] = 1

ans = 1
for i in d.values():
    ans *= i+1
print((ans-1)%D)