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

n = int(input())
l = list(input())
l = list(Counter(l).values())

ans = 1

for i in l:
    ans *= i+1
print((ans-1)%(10**9+7))

Solution (Python):
N = int(input())
S = input()
total = (2**N-1)%(10**9+7)
dicta = {}
for i in range(N):
    if S[i] not in dicta:
        dicta[S[i]] = 1
    else:
        dicta[S[i]] += 1
dup = [v for v in dicta.values()]
dc = 1
for i in dup:
    dc *= i+1
print((dc -1)%(10**9+7))

Solution (Python):
from fractions import gcd

from heapq import*
import math
from collections import defaultdict, Counter, deque
from bisect import *
import itertools
import fractions
import sys
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7



def main():
    n = int(input())
    s = input()
    c = Counter(s)
    ansm=1
    for i in range(26):
        v = chr(ord("a") + i)
        ansm *= (c[v] + 1)
        ansm%=MOD
    print((ansm -1 + MOD)%MOD)





if __name__ == '__main__':
    main()

Solution (Python):
import sys
import os
if sys.platform=="darwin":
	base = os.path.dirname(os.path.abspath(__file__))
	name = os.path.normpath(os.path.join(base, '../Documents/input.txt'))
	
	sys.stdin = open(name)

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

mod = 10**9+7

import collections
c = collections.Counter(s)

c_value_lst = list(c.values())


ans = 1

for i in c_value_lst:
    ans = ans * (i+1)
    
    ans = ans%mod
print(ans-1)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from collections import Counter

N = int(readline())
S = read().rstrip()

MOD = 10 ** 9 + 7

counter = Counter(S)

x = 1
for y in counter.values():
    x *= (y + 1)

x -= 1
answer = x % MOD
print(answer)

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

plist = [-1] * 65
def p(x):
    if plist[x] != -1:return plist[x]
    if x == 0:
        plist[x] = 1
        return 1
    if x % 2 == 0:
        plist[x] = p(x//2)*p(x//2)%MOD
        return plist[x]
    plist[x] = 2*(p(x//2)*p(x//2)%MOD)%MOD
    return plist[x]

def add(x,y):
    return (x+y) % MOD
def mul(x,y):
    return x*y % MOD

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

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

flag = True
for i in range(26):
    if cnt[i] > 1:
        flag = False

if flag:
     print(add(-1,p(N)))
else:
    ans = 1
    for i in range(26):
        ans = mul(ans,1+cnt[i])
    print(add(-1,ans))

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

alphabet='abcdefghijklmnopqrstuvwxyz'
nums=[1]*26
for i in range(N):
  ind=alphabet.index(S[i])
  nums[ind]+=1
out=1
for i in nums:
  out*=i
print((out-1)%(10**9+7))

Solution (Python):
n=int(input())
s=input()
d={}
for i in "abcdefghijklmnopqrstuvwxyz":
    d[i] = s.count(i)+1
ans = 1
for i in d:
    ans = (d[i] * ans)%(10**9+7)
print(ans-1)

Solution (Python):

import sys

MOD = 1000000007  
from collections import Counter
from itertools import product
def solve(N: int, S: str):
    counter = dict(Counter(S))
    values = list(counter.values())
    LEN = len(values)
    answer = values[0]+1
    if LEN >= 2:
        for i in range(1,LEN):
            answer *= values[i]+1
            answer%=MOD
    print(answer-1)
    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):
from collections import defaultdict

N = int(input())
S = input()
dd = defaultdict(int)

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

ans =1
mod = 10**9+7
for key,n in dd.items():
    ans=ans*(n+1)%mod

print(ans-1)

Solution (Python):

from collections import Counter
N = int(input())
S = input()
mod = 10**9+7

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

Solution (Python):


from collections import Counter
N = int(input())
S = input()

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

Solution (Python):
from collections import Counter
MOD = 10**9 + 7
def solve(n, s):
    res = 1
    for num in Counter(s).values():
        res = (res * (num+1)) % MOD
    return res - 1

n = int(input())
s = input()
print(solve(n, s))

Solution (Python):
n = int(input())
s = input()
mod = 10**9 + 7
"""
a~zの全てのアルファベットが1回以下使われる組み合わせ(複数ある場合は区別される)
を求めれば良い。
なお、部分列であるので、連続である必要はない。
Ex.
aが文字列に２つ含まれる場合。
どちらか片方を使う　で2通り
どちらも使わない　　で1通り
　　　　　　　　　　計3通りある。
なお、全ての組み合わせを求めた後、それには「全てを使わない」選択肢が含まれているので
全ての組み合わせ-1が答えとなる。
"""

import collections

c = collections.Counter(s)

c_value_lst = list(c.values())

ans = 1

for i in c_value_lst:
    ans *= (i+1)
    ans = ans%mod
print(ans-1)

Solution (Python):
n = int(input())
s = input()
mod = 10 ** 9 + 7
ans = 1
alfa = [chr(i) for i in range(97, 97+26)]
count = [0 for i in range(26)]
for i in range(n):
    x = s[i]
    y = alfa.index(x)
    count[y] += 1

for i in count:
    ans = (ans * (i + 1)) % mod
    
ans -= 1
print(ans)

Solution (Python):
from collections import Counter

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

mod = 10 ** 9 + 7
s = list(Counter(S).values())

ans = 1 
for i in s:
    ans *= (i+1)
    ans %= mod
print(ans-1)

Solution (Python):
from collections import Counter

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

c = Counter(S)
ret = 1
for v in c.values() :
  ret *= v + 1
  ret %= mod
  
print(ret - 1)

Solution (Python):
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    s = str(readline().rstrip().decode('utf-8'))
    s = collections.Counter(s)
    t = 1
    for k, v in s.items():
        t *= (v + 1)
        t %= mod
    print(t - 1)


if __name__ == '__main__':
    solve()

Solution (Python):
def examA(mod):
    N = I(); S = SI()
    d = defaultdict(int)
    ans = 1
    for s in S:
        d[s] +=1
    for i in d.values():
        ans *=(i+1)
    print((ans-1)%mod)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA(mod)

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

Solution (Python):
num = int(input())
words = input()
mod = 10**9+7

words_count = {}
for key in words:
    if key in words_count:
        words_count[key] += 1
    else:
        words_count[key] = 1

ans = 1
for key, val in words_count.items():
    ans *= (val + 1)

print((ans - 1) % mod)

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

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

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

Solution (Python):
import sys
import collections

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  

N = ri()
S = list(rs())
MOD = 10 ** 9 + 7
answer = 1
c = collections.Counter(S)
for k, v in c.items():
    answer = (answer * (v + 1)) % MOD

print(answer-1 if answer != 0 else MOD - 1)

Solution (Python):
N=int(input())
S=input()
import collections
counter=collections.Counter(S)
ans=1
for v in counter.values():
  ans*=(v+1)
print((ans-1)%(10**9+7))

Solution (Python):
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    s = str(readline().rstrip().decode('utf-8'))
    s = collections.Counter(s)
    t = 1
    for k, v in s.items():
        t = (t * (v + 1)) % mod
    print(t - 1)


if __name__ == '__main__':
    solve()

Solution (Python):

import sys
from collections import Counter

MOD = 10 ** 9 + 7

def main():
    n, s = sys.stdin.read().split()
    n = int(n)
    
    res = 1
    for c in Counter(s).values():
        res = res * (c + 1) % MOD

    res = (res - 1) % MOD

    print(res) 

if __name__ == '__main__':
    main()

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

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

Solution (Python):
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    s = str(readline().rstrip().decode('utf-8'))
    s = collections.Counter(s)
    t = 1
    for k, v in s.items():
        t *= (v + 1)
        t %= mod
    print(t - 1)


if __name__ == '__main__':
    solve()

Solution (Python):
from collections import Counter

MOD = 10**9 + 7
N = int(input())
S = input()
ans = 1
for key, num in Counter(S).items():
  ans *= num+1

print((ans-1)%MOD)

Solution (Python):
import collections
n = int(input())
s = list(input())
count = collections.Counter(s).most_common()
ans = 1
for x in count:
  ans = ans*(x[1]+1)
print((ans-1)%(10**9+7))

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

Solution (Python):
import collections

n = int(input())
s = input().rstrip()
MOD = 10**9 + 7

counter = collections.Counter(s)
res = 1
for v in counter.values():
    res *= v + 1
res -= 1
print(res % MOD)

Solution (Python):

import sys

input = sys.stdin.readline


sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7


def calc_next(N, S):
    dp = [[0 for i in range(26)] for i in range(N+1)]

    for i in range(N-1, -1, -1):
        for j in range(26):
            dp[i][j] = dp[i+1][j]
        dp[i][ord(S[i])-ord('a')] = i

    return dp


def main():
    N = int(input())
    S = input()
    a = [0 for i in range(26)]
    ans = 1

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

    for i in range(26):
        ans *= a[i] + 1
        ans %= MOD

    print(ans - 1)


if __name__ == '__main__':
    main()

Solution (Python):
from collections import defaultdict

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

d = defaultdict(int)
for key in S:
    d[key] += 1

ans = 1
for i in d.items():
    ans *= (i[1] + 1)
    ans %= INF

print((ans - 1))

Solution (Python):
from collections import defaultdict

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

d = defaultdict(int)
for key in S:
    d[key] += 1

ans = 1
for i in d.items():
    ans *= (i[1] + 1)

print((ans - 1) % INF)

Solution (Python):

import collections
mod = 10 ** 9 + 7
N = int(input())
S = list(input())
c = collections.Counter(S)
c = c.most_common()
ans = 1

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

Solution (Python):
n = int(input())
s = input()
l = {}
for c in s:
    if c in l:
        l[c] += 1
    else:
        l[c] = 1
ans = 1
for i in l.values():
    ans *= i+1
print((ans-1)%(10**9+7))

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

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

Solution (Python):
n=int(input())
s=list(input())
mod=10**9+7
s.sort()
k=1
lst=[]
for i in range(1,n):
    if s[i]==s[i-1]:
        k+=1
    else:
        lst.append(k)
        k=1
lst.append(k)
m=len(lst)
ans=1
for u in lst:
    ans=(ans*(u+1))%mod
print(ans-1)

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

Solution (Python):
n = int(input())
s = input()
l = {}
for c in s:
    if c in l:
        l[c] += 1
    else:
        l[c] = 1
ans = 1
for i in l.values():
    ans *= i+1
    ans %= (10**9+7)
print((ans-1)%(10**9+7))

Solution (Python):
n = int(input())
s = input()
l = {}
for c in s:
    if c in l:
        l[c] += 1
    else:
        l[c] = 1
ans = 1
for i in l.values():
    ans *= i+1
print((ans-1)%(10**9+7))

Solution (Python):
N = int(input())
S = input()
mod = 1e9 + 7
cnt = [1]*27
for c in S:
   cnt[ord(c) - ord('a')]+=1
ans = 1
for c in cnt:
   ans *= c
   ans %= mod
print(int(ans-1))

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

L = []
for i in range(len(S)):
  if len(L) == 0:
    L.append([S[i], 2])
  else:
    u = 0
    for j in range(len(L)):
      if S[i] == L[j][0]:
        L[j][1] += 1
        u += 1
    if u == 0:
      L.append([S[i], 2])
p = 1    
for l in range(len(L)):
  p *= L[l][1]
print(int((p - 1) % 1000000007))

Solution (Python):

import collections

N = int(input().split()[0])
S = input()
counter = collections.Counter(S)
count = 1
mod = 10 ** 9 + 7
for _, v in counter.items():
    
    count = count * (v + 1) % mod


ans = (count - 1) % mod
print(ans)

Solution (Python):
from collections import defaultdict
INF = 10**9+7

n = int(input())
s = str(input())
d = defaultdict(int)
ans = 0
for i in s:
    d[i]+=1
    t = 1
    for ch, cn in d.items():
        if ch ==i:
            continue
        t *= cn +1
    ans = (ans+t)%INF
print(ans)

Solution (Python):
from collections import Counter
from functools import reduce
from operator import mul

mod = 10 ** 9 + 7


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


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

cnt = Counter(s)

print(reduce(my_mul, (v + 1 for v in cnt.values())) - 1)

Solution (Python):
from collections import defaultdict

mod = 10 ** 9 + 7

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

d = defaultdict(int)

ans = 0
for c in s:
    d[c] += 1
    t = 1
    for chr_, cnt in d.items():
        if chr_ == c:
            continue
        t *= cnt + 1
    ans = (ans + t) % mod
print(ans)

Solution (Python):
from collections import Counter


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

    mod = 10 ** 9 + 7

    c = Counter(s)

    ans = 1
    for k, v in c.items():
        ans *= v + 1

    ans -= 1
    ans %= mod
    print(ans)


if __name__ == "__main__":
    main()

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

cha = {}

for i in range(n):
    if s[i] in cha:
        cha[s[i]] += 1
    else:
        cha[s[i]] = 1

cnt = []

for k in cha:
    cnt.append(cha[k])

ans = 1

for c in cnt:
    ans *= (c+1)
    ans %=10**9+7

print(ans-1)

Solution (Python):
N=int(input())
S=input()
a=0
l=[0]*26
for i in S:
    t=1
    for j in range(26):
        if j!=ord(i)-97:
            t*=(l[j]+1)%(10**9+7)
    a=(a+t)%(10**9+7)
    l[ord(i)-97]+=1
print(a)

Solution (Python):
N=int(input())
S=input()
a=0
l=[0]*26
for i in S:
    t=1
    for j in range(26):
        if j!=ord(i)-97:
            t*=(l[j]+1)%(10**9+7)
    a=(a+t)%(10**9+7)
    l[ord(i)-97]+=1
print(a)

Solution (Python):
n = int(input())
s = input().strip()
cnt = {k:0 for k in list(s)}
for k in s:
  cnt[k] = cnt[k] + 1
  
mod = 10 ** 9 + 7
ans = 1
for v in cnt.values():
  ans = (ans * (v+1)) % mod
ans = (ans + mod-1) % mod
print (ans)

Solution (Python):
from collections import Counter

n = int(input())
s = list(input())
c = Counter(s)
m = 10**9 + 7

ans = 1
for i in c:
    ans *= (c[i] + 1)
    ans %= m
ans -= 1

print(ans)

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

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

print((ans-1) % MOD)

Solution (Python):
from collections import Counter

N = int(input())
S = list(input())
mod = 10 ** 9 + 7
s = list(Counter(S).values())
answer = 1
for i in s:
    answer = answer * (i + 1) % mod

print(answer - 1)

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

Solution (Python):
from collections import Counter
n=int(input())
s=str(input())
a=Counter(s)
aa=list(a.values())

ans=1
for i in aa:
    ans*=(i+1)%(10**9+7)
print((ans-1)%(10**9+7))

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

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

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

Solution (Python):
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = collections.Counter(str(input().rstrip('\n')))
    t = 1
    for k, v in s.items():
        t = (t * (v + 1)) % (10 ** 9 + 7)
    print(t - 1)


if __name__ == '__main__':
    slove()

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

ans = 1
import string
A = [chr(i) for i in range(ord('a'), ord('z')+1)]
B = {}
for i in range(len(A)):
    B[A[i]] = i
C = [1] * 26

for i in range(n):
    C[B[s[i]]] += 1

for i in range(len(C)):
    ans = (ans * C[i]) % mod

print(ans-1)

Solution (Python):
from collections import Counter 
n = int(input())
s = list(input())
count = Counter(s)
ans = 1
for k in count.values():
  ans *= k+1
  ans %= 1000000007
print(ans-1)

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

d={}
alphabet_s=[chr(i) for i in range(97,97+26)]
for c in alphabet_s:
    d[c]=0

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

ans=1
for c in alphabet_s:
    ans=(ans*(d[c]+1))%p


ans-=1

print(ans)

Solution (Python):
n=int(input())
s=input()
mod=10**9+7
t=dict()
for c in s:
    t.setdefault(c,1)
    t[c]+=1
ans=1
for v in t.values():
    ans=ans*v%mod
print(ans-1)

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

Solution (Python):
from collections import Counter


def resolve():
    n = int(input())
    s = input()
    c = Counter(s)
    ans = 1
    mod = 10 ** 9 + 7
    for v in c.values():
        ans *= v + 1
        ans %= mod
    print(ans - 1)


if __name__ == "__main__":
    resolve()

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

Solution (Python):
from collections import defaultdict

n = int(input())
d = defaultdict(int)

for s in input():
    d[s] += 1

ans = 1
for num in d.values():
    ans *= (num + 1)

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

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

Solution (Python):

dic = {}

N = int(input())

S = input()

for i in range(N):

    if S[i] not in dic:
        dic[S[i]] = 1

    else:
        dic[S[i]] += 1
        
ans = 1

for i in dic:

    ans *= dic[i] + 1

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

Solution (Python):

dic = {}

N = int(input())

S = input()

for i in range(N):

    if S[i] not in dic:
        dic[S[i]] = 1

    else:
        dic[S[i]] += 1
        
ans = 1

for i in dic:

    ans *= dic[i] + 1

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

Solution (Python):

dic = {}

N = int(input())

S = input()

for i in range(N):

    if S[i] not in dic:
        dic[S[i]] = 1

    else:
        dic[S[i]] += 1
        
ans = 1

for i in dic:

    ans *= dic[i] + 1

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

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

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

ans = mod - 1 if ans == 0 else ans - 1
print(ans)

Solution (Python):
n = int(input())
s = input()
ch = {}
for c in s:
  if c in ch:
    ch[c] += 1
  else:
    ch[c] = 1

ans = 1

for c in ch:
  ans *= 1 + ch[c]
  
  while ans >= 1000000007:
    ans -= 1000000007

ans += 1000000007
ans -= 1
while ans >= 1000000007:
  ans -= 1000000007

print(ans)

Solution (Python):
N = int(input())
S = input()
ns = {}
for c in S:
  if c not in ns: ns[c] = 0
  ns[c] += 1
r = 1
for c in ns:
  n = ns[c]
  r = r*(n+1)%1000000007
r -= 1
print(r)

Solution (Python):
from collections import Counter
input()
c=Counter(input())
a=1
for i in c.items():
    a*=(1+i[1])
    a%=10**9+7
print(a-1)

Solution (Python):
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(str(input().rstrip('\n')))
    a = collections.Counter(a)
    cnt = 1
    for k, v in a.items():
        cnt = (cnt * (v + 1) % (10 ** 9 + 7))
    print(cnt - 1)


if __name__ == '__main__':
    slove()

Solution (Python):
from collections import Counter

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

cntS = Counter(S)

ans = 1
for c in cntS.values():
    ans *= (c + 1)
    ans %= MOD

print((ans - 1) % MOD)

Solution (Python):
import collections as c

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

S=list(c.Counter(S).items())


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

Solution (Python):

n = int(input())
s = str(input())
b = 10 ** 9 + 7 



sum=0
alphabet=['a', 'b', 'c', 'd' ]
alphabet=[chr(i) for i in range(97, 97 + 26)]
for i in alphabet:
    count=s.count(i)
    sum = (sum * (count + 1) + count ) % b     
    
print(sum)

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

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

Solution (Python):
import collections
from functools import reduce
N=int(input())
S=input()
c=collections.Counter(S)
d=map(lambda x:x+1,list(c.values()))
print((reduce(lambda x,y:x*y,d)-1)%1000000007)

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

S_dict = {}
for s in S:
    if s not in S_dict:
        S_dict[s] = 1
    else:
        S_dict[s] += 1

ans = 1
for v in S_dict.values():
    ans *= (v + 1)
    ans %= mod

print(ans - 1)

Solution (Python):
MOD = 1000000007
N = int(input())
S = input()
ans = 1
for c in "abcdefghijklmnopqrstuvwxyz":
  ans *= (S.count(c) + 1)
  ans %= MOD
ans = (ans - 1 + MOD) % MOD
print(ans)

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

d = defaultdict(int)
for i in range(n):
    d[s[i]] += 1

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

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

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

alpha="abcdefghijklmnopqrstuvwxyz"
MOD=10**9+7

c=[0]*26

for i in range(N):
    c[alpha.index(S[i])]+=1
ans=1
for i in range(26):
    ans*=c[i]+1

ans=(ans-1)%MOD
print(ans)

Solution (Python):
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = str(input().rstrip('\n'))
    s = collections.Counter(s).most_common()
    t = 1
    for k, v in s:
        t = (t * (v + 1)) % (10 ** 9 + 7)
    print(t - 1)


if __name__ == '__main__':
    slove()

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

abc = "abcdefghijklmnopqrstuvwxyz"

ans = 1
for i in abc:
    ans *= s.count(i)+1
print((ans-1)%(10**9+7))

Solution (Python):
n,s=open(0);a=1
for c in set(s.strip()):a*=s.count(c)+1
print(~-a%(10**9+7))

Solution (Python):
from collections import defaultdict

if __name__ == '__main__':
    mod = 10**9 +7
    N = int(input())
    S = str(input())

    letter = defaultdict(int)
    letter_count = defaultdict(int)
    count = 0
    for i in range(N):
        new_count = count + 1
        new_count -= letter[S[i]] 
        count += new_count
        letter[S[i]] += new_count 
        
        
        for key in letter:
            if key != S[i]:
                letter[key] += letter[key]//(1 + letter_count[S[i]])
        letter_count[S[i]] += 1
    print(count%mod)

Solution (Python):
from collections import defaultdict
if __name__ == '__main__':
    mod = 10**9 +7
    N = int(input())
    S = str(input())
    
    letter = defaultdict(int)
    for i in range(N):
        letter[S[i]] += 1
    count = 1
    for c in letter:
        count *= (letter[c]+1)
        count %= mod
    print(count-1)

Solution (Python):
def mul(a,b,p):
    return ((a % p) * (b % p)) % p

def div(a,b,p):
    return mul(a, power_func(b, p-2,p),p)

def power_func(a,n,p):
  bi=str(format(n,"b"))
  res=1
  for i in range(len(bi)):
    res=(res*res) %p
    if bi[i]=="1":
      res=(res*a) %p
  return res

modp = 1000000007
_ = input()
s = input()
d = dict()
for c in s:d[c] = d.get(c,0)+1

g = power_func(2,len(d),modp)
g = (g+modp-1) % modp

for c in sorted(d.keys()):
    subsubg = div((g+1)%modp,2,modp)
    subg = (subsubg % modp) * ((d[c]-1)%modp) % modp
    g = (g + subg) % modp
print(g)

Solution (Python):
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    s = collections.Counter(str(input().rstrip('\n')))
    cnt = 1
    for k, v in s.items():
        cnt *= (v + 1)
        cnt %= (10 ** 9 + 7)
    print(cnt - 1)


if __name__ == '__main__':
    slove()

Solution (Python):
n = int(input())
s = input()
abc = "abcdefghijklmnopqrstuvwxyz"
ans = 1
for i in abc:
    ans *= s.count(i)+1
print((ans-1)%(10**9+7))

Solution (Python):
def main():
    N = int(input())
    S = input()
    mod = pow(10, 9) + 7
    d = dict()
    for c in S:
        d[c] = d.get(c, 0) + 1
    ans = 1
    for c in d:
        ans *= (d[c]+1)
        ans %= mod
    return (ans - 1) % mod


if __name__ == '__main__':
    print(main())

Solution (Python):
from collections import defaultdict

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

counter = defaultdict(int)
for s in S:
    counter[s] += 1

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

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

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

Solution (Python):



def main():
    from collections import Counter

    n = int(input())
    s = Counter(input())
    ans = 1
    mod = 10 ** 9 + 7

    
    

    
    
    
    for index, count in s.items():
        
        ans *= count + 1
        ans %= mod

    
    print(ans - 1)


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
s=list(input())
mod=10**9+7
al="abcdefghijklmnopqrstuvwxyz"
ans=1
for i in range(26):
    c=al[i]
    ans*=(s.count(c)+1)
    ans%=mod

print(ans-1)

Solution (Python):



import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
s = input()
t = list(Counter(s).items())
ans = 1
for i,j in t:
    ans *= j+1
    ans %= mod
ans -= 1
print(ans)

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

dic = defaultdict(int)

for i in S:
    dic[i] += 1

ans = 1
for i in dic:
    ans *= dic[i] + 1
    ans %= MOD

print (ans - 1)

Solution (Python):
from collections import Counter

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

counter=Counter(S)

mod=10**9+7
ans=1

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

Solution (Python):
import collections
n = int(input())
s = collections.Counter(list(input())).most_common()

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

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

s_list = collections.Counter(S)
s_list = list(s_list.items())
ans = 1
for i in range(len(s_list)):
    ans *= (s_list[i][1]+1)
    ans %= 10**9+7

print(ans-1)

Solution (Python):
from collections import Counter

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

words = Counter(s).values()

ans = 1
for i in words:
    ans *= i+1

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

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

Solution (Python):
import sys
input=sys.stdin.readline

N = int(input())
S = input().strip()
h = {}
for c in S:
    if c in h:
        h[c] += 1
    else:
        h[c] = 1

ans = 1
for v in h.values():
    ans *= v+1
ans -= 1

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

Solution (Python):
from collections import Counter 

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

MOD = 10 ** 9 + 7
C = Counter(S)

ans = 1
for ch in C:
    ans *= C[ch] + 1
    ans %= MOD
ans = (ans - 1) % MOD
print(ans)

Solution (Python):
n,s=open(0);a=1
for x in range(26):a*=-~s.count(chr(97+x))
print(~-a%(10**9+7))

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

Solution (Python):
import itertools
num2alpha = lambda c: chr(c+64)
alpha2num = lambda c: ord(c) - ord('A') + 1

N = int(input())
S = list(input())
S_unique = list(set(S))
S_kind = len(S_unique)

count_list = [0] * 27

for i in range(1,27):
    tmp = num2alpha(i).lower()
    count = S.count(tmp)
    count_list[i] = count % 1000000007

count_list_new = []
for i in range(len(count_list)):
    if count_list[i] != 0:
        count_list_new.append(count_list[i]+1)


ans = 1
for i in range(len(count_list_new)):
    ans *= count_list_new[i] % 1000000007

ans -= 1
print(ans % 1000000007)

Solution (Python):

from collections import Counter


def main():
    _ = int(input())
    S = input().rstrip()
    MOD = 10 ** 9 + 7
    ans = 1
    for i in Counter(S).values():
        ans *= i + 1
        ans %= MOD
    print(ans - 1)


if __name__ == "__main__":
    main()