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):
mod = int(10**9+7)
N = int(input())
S = input()
S = list(S)
alp = ['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']
cnt = [S.count(c) for c in alp]
ans = 1
for i in range(len(cnt)):
    ans *= (cnt[i]+1) % mod
if ans == 0:
    print(mod-1)
else:
    print((ans-1) % mod)

Solution (Python):
mojisu=int(input())
moji=input()
mojilist=[]
zenlen=len(moji)
mojilist.append([moji[0], 1])
moji=moji[1:]
for i in range(len(moji)):
    molswi=0
    for mol in range(len(mojilist)):
        if mojilist[mol][0]==moji[i]:
            mojilist[mol][1]+=1
            molswi=1
        if mol==len(mojilist)-1 and molswi==0:
            mojilist.append([moji[i], 1])


kazu=2**(mojisu)
amari=1
for mol in mojilist:
    amari=amari*(mol[1]+1)%(10**9+7)
print(amari-1)

Solution (Python):
nn = int(input())
s = str(input())
a = s.count('a')
b = s.count('b')
c = s.count('c')
d = s.count('d')
e = s.count('e')
f = s.count('f')
g = s.count('g')
h = s.count('h')
i = s.count('i')
j = s.count('j')
k = s.count('k')
l = s.count('l')
m = s.count('m')
n = s.count('n')
o = s.count('o')
p = s.count('p')
q = s.count('q')
r = s.count('r')
ss = s.count('s')
t = s.count('t')
u = s.count('u')
v = s.count('v')
w = s.count('w')
x = s.count('x')
y = s.count('y')
z = s.count('z')
print(((q+1)*(w+1)*(e+1)*(r+1)*(t+1)*(y+1)*(1+u)*(1+i)*(o+1)*(p+1)*(a+1)*(1+ss)*(1+d)*(1+f)*(1+g)*(1+h)*(1+j)*(1+k)*(1+l)*(1+z)*(x+1)*(c+1)*(1+v)*(b+1)*(n+1)*(m+1)-1)%(10**9+7))

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

Solution (Python):


import math
import numpy as np
import random
import copy
import statistics 
import bisect
import heapq
from collections import defaultdict 



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

num = defaultdict(int)

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

cnt = 1
for s in num:
    cnt = cnt * (num[s] + 1)
    cnt = cnt % (10 ** 9 + 7)

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

print (cnt)

Solution (Python):
N = int(input())
S = input()
ans = 1
for c in range(ord('a'), ord('z') + 1):
	ans *= S.count(chr(c)) + 1
print((ans-1) % (10**9 + 7))

Solution (Python):
N = int(input())
S = input()
m = 10**9 + 7
nl = [0 for i in range(26)]
for s in S:
    nl[ord(s)-97] += 1
ans = 1
for i in range(26):
    if nl[i] == 0:
        continue
    else:
        ans *= nl[i] + 1
        ans = ans % m
print(ans-1)

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

m={}

for c in s:
    if c not in m:
        m[c]=1
    else:
        m[c]+=1
        
ans=1

for k in m.keys():
    ans*=(m[k]+1)

print((ans-1)%1000000007)

Solution (Python):
from collections import defaultdict
mod = 10**9+7
N = int(input())
S = input()
d = defaultdict(lambda:0)
for i in range(N):
    d[S[i]]+=1
ans = 1
for x in d:
    ans *= d[x]+1
    ans %= mod
ans -= 1
print(ans)

Solution (Python):
N = int(input())
S = list(str(input()))
ch = list(set(S))
cal = []
for i in ch:
  cal.append(S.count(i))
ans = 1
for i in cal:
  ans *= i+1  
  ans = ans %(10**9+7)

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

Solution (Python):
import collections

mod = 1000000007

def add(a, b):
    return (a + b) % mod

def sub(a, b):
    return (a + mod - b) % mod

def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def power(x, y):
    if   y == 0     : return 1
    elif y == 1     : return x % mod
    elif y % 2 == 0 : return power(x, y//2)**2 % mod
    else            : return power(x, y//2)**2 * x % mod

def div(a, b):
    return mul(a, power(b, mod-2))

def solve():
    N=int(input())
    S=list(input())
    c=collections.Counter(S)
    ans=1
    for k in c.keys():
        ans = mul(ans,c[k]+1)
    return sub(ans,1)

print(solve())

Solution (Python):
from collections import Counter
mod = 10 ** 9 + 7
n = int(input())
S = input()

ans = 1
for i in Counter(S).values():
    ans = ans * (i + 1) % mod

print(ans - 1)

Solution (Python):
INF = 1000000007

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

counts = {}
for s in S:
	counts[s] = counts.get(s, 0) + 1

pattern = 1
for count in counts.values():
	pattern *= 1 + count
	pattern %= INF
pattern -= 1
pattern %= INF

print(pattern)

Solution (Python):
N = int(input())
S = input()
bet = list("abcdefghijklmnopqrstuvwxyz")
countlist = []
for i in range(len(bet)):
    if S.count(bet[i]) != 0:
        countlist.append(S.count(bet[i]))
result = 1

for j in range(len(countlist)):
    result *= countlist[j]+1
    result %= 10**9+7


print(result-1)

Solution (Python):
import collections
n = int(input())
s = input()
t = collections.Counter(s)
u = list(set(s))
cnt = 1
for i in range(len(u)):
    cnt *= t[u[i]]+1
print((cnt-1)%(10**9+7))

Solution (Python):
N = int(input())
S = input()
p = 10 ** 9 + 7
P = 1
for i in range(26):
  P *= S.count(chr(97 + i)) + 1
  P %= p
print(P - 1)

Solution (Python):
n = int(input())
s = [i for i in str(input())]
import collections
c = collections.Counter(s)
ans = 1
for v in c.values():
    ans = ans * (v+1)
ans = ans - 1
ans = ans % (10 ** 9 + 7)
print(ans)

Solution (Python):
N = int(input())
S = input()
ans = 1
for i in range(97, 97+26):
    n = S.count(chr(i))
    ans = ans * (n+1)
print((ans -1)%(10**9+7))

Solution (Python):

MOD = 1000000007

N = input()
S = input()

ans = 1
for i in range(26):
    c = chr(ord('a') + i)
    ans *= S.count(c) + 1
    ans %= MOD
    
print(ans-1)

Solution (Python):
dic ={}
N =input()
mod = 10**9 +7
for i in input():
    if i in dic.keys():
        dic[i] += 1
    else:
        dic[i] = 1
ans = 1
for i in dic.values():
    ans *= i+1
    ans = ans % mod
print(ans-1)

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

mod = 10 ** 9 + 7

import collections

c = collections.Counter(S)

result = 1
for key in c.keys():
    result *= (1 + c[key]) % mod

result = (result - 1) % mod

print(result)

Solution (Python):
import sys
DBG = True
BIG = 1000000007
n = int(input())
s = input()
cnt = { 'a':0, 'b':0, 'c':0, 'd':0, 'e':0, 'f':0, 'g':0, 'h':0, 'i':0, 'j':0, 'k':0, 'l':0, 'm':0, 'n':0, 'o':0, 'p':0, 'q':0, 'r':0, 's':0, 't':0, 'u':0, 'v':0, 'w':0, 'x':0, 'y':0, 'z':0 }
for i in range(n):
    cnt[s[i]] += 1

prod = 1
for key in cnt:
    prod = (prod * (cnt[key] + 1)) % BIG
print((prod-1)%BIG)

Solution (Python):

n=int(input())
s=input()
from collections import Counter
cs=Counter(list(s))
a=list(cs.values())
t=a[0]
for i in range(1,len(a)):
    t+=a[i]*(1+t)
print(t%(10**9+7))

Solution (Python):



import collections 

n=input()
s=input()

d=collections.Counter(s)



ans = 1
for i in d:
    ans *= d[i]+1
    ans = ans%(10**9+7)

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

Solution (Python):
from collections import Counter

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

mod = 10**9 + 7

cnt_dict = Counter(s)
ans = 1
for v in cnt_dict.values():
    ans *= v + 1
ans -= 1
print(ans % mod)

Solution (Python):
from collections import Counter
mod = 10**9+7
x = int(input())
s = input()
t = Counter(s).most_common()

ans = 1
for c, n in t:
    ans *= (n+1)%mod

print((ans-1)%mod)

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

Solution (Python):
from functools import reduce
n=int(input())
s=input()
count=[1 for i in range(26)]
for i in range(n):
    count[ord(s[i])-ord('a')]+=1
print((reduce(lambda a,b:a*b ,count)-1)%(10**9+7))

Solution (Python):
n = int(raw_input())
s = str(raw_input())
count = [0]*(26)
result = 1
for i in xrange(n):
	count[ord(s[i])-97]+=1
for i in count:
	result = result * (i+1)
	result = result % 1000000007
print result - 1

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):
import collections
import functools

n = int(input())
s = list(input())
md = 10 ** 9 + 7

c = [x + 1 for x in dict(collections.Counter(s)).values()]

ans = functools.reduce(lambda a, b: a * b, c) - 1
print(ans % md)

Solution (Python):
L = [0]*26
N = int(input())
S = input()

MOD = 10**9+7

for i in range(N):
    temp = ord(S[i]) - ord("a")
    L[temp] += 1

ans = 1
for a in L:
    if a:
        ans *= (a+1)
        ans %= MOD

print(ans-1)

Solution (Python):

def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n=I()
S=S()
Sd={}
for s in S:
    if s in Sd:
        Sd[s]+=1
    else:
        Sd[s]=1
one=0
for key in Sd.keys():
    if Sd[key]==1:
        one+=1
ans=2**one-1
for key in Sd.keys():
    if Sd[key]>=2:
        ans+=(ans+1)*Sd[key]
ans=ans%(10**9+7)
print(ans)

Solution (Python):
import collections

N = int(input())
S = str(input())
S_ = [str(x) for x in S]
c = collections.Counter(S_)

p = 1
for c_ in list(c.values()):
  p *= c_+1
print((p-1)%(10**9+7))

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

cnt = [0] * 26

for ss in S:
    cnt[ord(ss) - 97] += 1

sum = 1
mmd = 10 ** 9 + 7
for c in cnt:
    sum = (sum * (c + 1)) % mmd
print(sum - 1)

Solution (Python):
from collections import Counter

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

c = Counter(S)
r = 1
for _,n in c.items():
    r *= (n+1)
    r %= MOD

print(r-1)

Solution (Python):

from collections import defaultdict

def solve():
    N = int(input())
    S = input()
    M = defaultdict(int)
    for s in S:
        M[s] += 1
    M = dict(M)
    res = 1
    for m in M.values():
        res *= (m+1)
        res %= (10**9+7)
    res -= 1
    return str(res)
if __name__ == '__main__':
    print(solve())

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

ans = 1
for i in range(26):
    c = chr(ord('a')+i)
    n = S.count(c)
    if n > 0:
        ans = (ans * (n+1)) % M

ans -= 1
print(ans)

Solution (Python):
N = int(input())
S = list(input())
setS = set(S)

ans = 1
for i in setS:
    cnt = S.count(i)
    
    ans = ans * (cnt + 1) % (10 ** 9 + 7)
    

print(ans-1)

Solution (Python):
n = int(input())
s = str(input())
d ={}
for i in range(n):
  x = s[i]
  if x not in d:
    d[x] = 1
  else:
    d[x] += 1
ans = 1
for a in d.values():
  ans = ans*(a+1)
  
print((ans-1)%(10**9+7))

Solution (Python):
n = int(input())
s = input()
alpha = [0 for _ in range(ord("z") - ord("a") + 1)]

for i in range(len(s)):
    alpha[ord(s[i]) - ord("a")] += 1

_sum = alpha[0] + 1
for i in range(1, len(alpha)):
    _sum *= alpha[i] + 1
print((_sum - 1) % (10 ** 9 + 7))

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

_dict = {}

for s in S:
  _dict[s] = _dict.get(s, 0) + 1

ans = 1
for y in [x+1 for x in _dict.values()]:
  ans = (ans * y)%(10**9 +7)

print(ans -1)

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

a = {}
for i in range(n):
    if s[i] not in a:
        a[s[i]] = 1
    else:
        a[s[i]] += 1
count = 1
for i in a.keys():
    count *= a[i] + 1
    count %= 10 ** 9 + 7
print(count-1)

Solution (Python):

from collections import defaultdict, Counter
from itertools import permutations, product, combinations
from bisect import bisect, bisect_left
from fractions import gcd
MOD = 10**9 + 7

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

N = int(input())
S = input()
C = Counter(S)
ans = 1
for v in C.values():
    ans = (ans*(v+1))%MOD
print(ans-1)

Solution (Python):
n = int(raw_input())
s = raw_input().strip()
mod = 1000000007
ret = 1
for c in "abcdefghijklmnopqrstuvwxyz":
    ret = (ret * (s.count(c) + 1)) % mod
print (ret + mod - 1) % mod

Solution (Python):
from collections import Counter

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

mod = 10**9 + 7

c = Counter(s)

ans = 1
for i in range(26):
    w = chr(ord('a')+i)
    ans *= c[w] + 1
    ans %= mod

print(ans-1)

Solution (Python):
n=int(input())
s=input()
l=list(s)
sl=set(l)

import collections

c=collections.Counter(l)
ans=1
for i in sl:
    ans*=(c[i]+1)

print((ans-1)%1000000007)

Solution (Python):
n = int(input())
S = str(input())
ss = sorted((set(list(S))))
k = []
for i in range(len(ss)):
	k.append(S.count(ss[i])+1)
tmp = 1
for i in range(len(k)):
	tmp *= k[i]
ans = tmp - 1
anss = ans % (10**9+7)
print(anss)

Solution (Python):
n = int(input())
s = input()
count = {}
for c in s:
    if c not in count:
        count[c] = 1
    else:
        count[c] += 1
ret = 1
for _, c in count.items():
    ret *= c + 1
print((ret - 1) % (10**9 + 7))

Solution (Python):
n = int(input())
s = input()
s2 = set(s)
s2 = list(s2)
ans = 1
for i in range(len(s2)):
    a = s.count(s2[i])
    ans *= a+1
ans = ans-1
print(ans%(10**9+7))

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

L = [chr(i) for i in range(97, 123)]

X = []
for i in L:
    X.append(S.count(i))

s = 1
for i in X:
    s = (i + 1) * s
    s = s % 1000000007

print(s - 1)

Solution (Python):
from collections import Counter


def main():
    
    
    
    
    
    input()
    s = input()

    a = Counter(s)
    AL = "abcdefghijklmnopqrstuvwxyz"

    v = [a[b] + 1 for b in AL if a[b] != 0]

    res = 1
    V = 10 ** 9 + 7
    for a in v:
        res *= a % V
        res %= V
    print(res - 1)


if __name__ == '__main__':
    main()

Solution (Python):
import collections

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

c = collections.Counter(list(S))

ans = 1
for _, n in c.most_common():
    ans *= (n+1)
    ans %= 1000000007
print(ans-1)

Solution (Python):
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD = 10**9 + 7

N=ri()
S=input()

cnt = [1]*26
ord_a = ord('a')

for s in S:
    cnt[ord(s) - ord_a] += 1

ans = 1
for c in cnt:
    ans *= c
    ans %= MOD

ans -= 1
print(ans)

Solution (Python):
from collections import Counter
N = int(input())
S = input()
MOD = 10**9+7

ctr = Counter(S)
ans = 1
for v in ctr.values():
    ans *= (v+1)
ans-=1
print(ans%MOD)

Solution (Python):
import math

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

l=[]
for i in range(26):
	l.append(0)

for i in range(n):
	l[ord(s[i])-97]+=1

p=1000000007
ans=1
for i in range(26):
	ans*=(l[i]+1)%p

ans=ans%p

ans-=1

print(ans)

Solution (Python):
from collections import defaultdict,Counter

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

d=  defaultdict(int)
back = 0
front =1
ans = 1
c= Counter(S)

for i in c:
    ans *= c[i]+1
    ans = ans%(10**9+7)


print(ans-1)

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
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 LF(): return [float(x) 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()
    global ans
    ans = 1
    from collections import Counter
    cnt = Counter(S)
    for n in cnt.values():
        ans = (ans * (n + 1)) % MOD

    ans -= 1
    return ans

print(main())

Solution (Python):
N = int(input())
S = list(input())
p = 10**9 + 7
Count = 1
for i in range(26):
    letter = chr(97+i)
    Count *= S.count(letter) + 1
    Count = Count%p
print(Count-1)

Solution (Python):
a=int(input())
b=input()

num=[1]*26

for c in b:
    num[ord(c)-ord('a')]+=1

ans=1
div=1000000007
for i in num:
    ans*=i
    ans%=div
print(ans-1)

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

n = int(input())
s = input()
cs = list(s)
cnts = {}
for c in cs:
  if c in cnts:
    cnts[c] += 1
  else:
    cnts[c] = 1

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

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import Counter

n = ni()
s = ns()

MOD = 10**9+7

cnt = Counter(s)
ans = 1

for key, val in cnt.items():
    ans *= (val+1)
    ans %= MOD
    
ans -= 1
if ans < 0:
    ans += MOD
    
print(ans)

Solution (Python):
INF = 999999999999999999L
EPS = 1e-12

def read():
    return raw_input().strip()

def read_ints():
    return map(int,read().split())

n = int(read())
s = read()
cnts = [0]*26 
for c in s:
    cnts[ord(c)-ord("a")] += 1


ans = 1
for i in range(26):
    ans = ans * (cnts[i]+1) 
ans -= 1 
print ans % (10**9+7)

Solution (Python):
N = int(input())
S = input()
d = {}
l = "abcdefghijklmnopqrstuvwxyz"
for i in l:
    d[i] = 0
for i in S:
    d[i] += 1
ans = 1
for i in l:
    ans = (ans * (d[i] + 1)) % 1000000007
print(ans - 1)

Solution (Python):
N = int(input())
s = input()
def stoi(s):
    return ord(s)-97
X = [1] * 26
for ss in s:
    X[stoi(ss)] += 1

ans = 1
P = 10**9+7
for x in X:
    ans *= x
    ans %= P
print((ans - 1) % P)

Solution (Python):
from collections import Counter
N = int(input())
S = input()
MOD = 10 ** 9 + 7
ct = Counter(S)
ans = 1
for k, v in ct.items():
  ans *= v + 1
  ans %= MOD
print(ans - 1)

Solution (Python):
import sys
sys.setrecursionlimit(20000000)
input = sys.stdin.readline
n = int(input())
s = input()
a = [0]*26
ans = 1
mod = 10**9+7
for i in range(n):
        a[ord(s[i]) - ord("a")] += 1
for i in a:
        ans *= (i+1)
        ans%=mod
print(ans-1)

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

T = [0]*26
for s in S:
  T[ord(s)-ord("a")] += 1

ans = 1
mod = 10**9+7
for i in range(26):
  ans *= T[i]+1
  ans %= mod
print (ans-1)%mod

Solution (Python):
from collections import defaultdict
n = int(raw_input())
s = raw_input().strip()
ans = 1
d = defaultdict(int)
for c in s:
    d[c] += 1
for v in d.viewvalues():
    ans = ans * (v + 1) % 1000000007
print (ans - 1) % 1000000007

Solution (Python):
import string

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

MOD = 10 ** 9 + 7

d = dict()
for ss in s:
    d[ss] = d.get(ss, 0) + 1
ans = 1
for c in string.ascii_lowercase:
    ans *= (d.get(c, 0) + 1)
    ans %= MOD
ans -= 1
print(ans)

Solution (Python):
N=int(input())
X=[0 for i in range(26)]
S=input()
for i in S:
    X[ord(i)-97]+=1
ans=1
P=10**9+7
for i in X:
    ans=ans*(i+1)
    ans%=P
ans-=1
print(ans)

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

N = int(input())
S = input()
c = Counter(S)
ans = 1
for v in c.values():
    ans *= (v + 1)
print((ans - 1) % 1000000007)

Solution (Python):
N = int(input())
S = input()
mod = 1e9 + 7
dic =  { i:0  for i in [chr(i) for i in range(97, 97+26)] }
for i in range(N):
    dic[S[i]] += 1

ans = 1
for value in dic.values():
    ans *= (value+1)
    ans %=  mod
print(int((ans-1) %mod))

Solution (Python):
N = int(input())
S = input()
ans = 1
for c in [chr(ord('a') + i) for i in range(26)]:
    ans = (ans * (S.count(c) + 1)) % (10**9 + 7)
ans = (ans - 1) % (10**9 + 7)
print(ans)

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

AL=[0]*26

for s in S:
    AL[ord(s)-97]+=1

ANS=1

for al in AL:
    if al>0:
        ANS=ANS*(al+1)%mod

print((ANS-1)%mod)

Solution (Python):

"""
This file is part of https://github.com/cheran-senthil/PyRival
Copyright 2019 Cheran Senthilkumar <hello@cheran.io>

"""
from __future__ import division, print_function

import itertools
import os
import sys
from atexit import register
from cStringIO import StringIO
from collections import Counter

range = xrange

filter = itertools.ifilter
map = itertools.imap
zip = itertools.izip

sys.stdout = StringIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = StringIO(os.read(0, os.fstat(0).st_size)).readline

MOD = 10**9 + 7
MODF = float(MOD)

MAGIC = 6755399441055744.0
SHRT = 65536.0

MODF_INV = 1.0 / MODF
SHRT_INV = 1.0 / SHRT

fround = lambda x: (x + MAGIC) - MAGIC
fmod = lambda a: a - MODF * fround(MODF_INV * a)
fmul = lambda a, b, c=0.0: fmod(fmod(a * SHRT) * fround(SHRT_INV * b) + a * (b - SHRT * fround(b * SHRT_INV)) + c)


def main():
    n = input()
    s = input().rstrip('\r\n')

    res = 1
    for key, value in Counter(s).items():
        res = fmul(res, (value + 1))

    print(int(res - 1) % MOD)


if __name__ == '__main__':
    main()

Solution (Python):
'''input
3
abb
4
abcd
'''
import collections
n = int(input())
s = input()
MOD = int(1e9 + 7)
d = collections.Counter(s)
ans = 1
for k, v in d.items():
	ans = ans * (v + 1)
print((ans - 1) % MOD)

Solution (Python):
N=int(input())
S=input()
from collections import defaultdict
data=defaultdict(int)
for i in range(N):
    data[S[i]]+=1
ans=1
for j in data.values():
    ans=(ans*(j+1))%(10**9+7)
print(ans-1)

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

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

ans = 1
for c in char:
	ans *= char[c]+1
	ans %= 10**9+7
print(ans-1)

Solution (Python):
from collections import Counter


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

cur_count = 1
for count in ctr_S.values():
    cur_count *= (count + 1)
    cur_count %= MOD

print(cur_count - 1)

Solution (Python):
input()
s=input()
d={}
for t in s:d[t]=d.get(t,0)+1
r=1
for k in d.values():r*=k+1;r%=1000000007
print(r-1)

Solution (Python):
from collections import Counter

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

MOD = 10**9+7
N = int(input())
S = input()[:-1]
C = Counter(S)
ans = 1
for v in C.values():
    ans = ans*(v+1) % MOD
print(ans-1)

Solution (Python):
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict, Counter
from bisect import bisect

setrecursionlimit(10**7)

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

M = 10 ** 9 + 7

N = read()
S = input()

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

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007


def A():
    n = I()
    s = S()
    d = defaultdict(int)
    for i in s:
        d[i] += 1
    ans = 1
    for i in d.keys():
        ans *= d[i]+1
        ans %= mod
    print(ans-1)

def B():
    return


def C():
    return


def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == "__main__":
    A()

Solution (Python):
N=int(input())
S=input()
count={}
for s in S:
    count[s]=count.get(s,0)+1
retval=1
for c in count:
    retval*=(count[c]+1)
print((retval-1)%(10**9+7))