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):
N = int(input())
S = input()

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

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

Solution (Python):
from collections import Counter

N = int(input())
s = input()
c = Counter(s)
cum = list(dict(c).values())
ans = 1
for ele in cum:
    ans *= (ele+1)
print((ans-1) % (10**9+7))

Solution (Python):
n=int(input())
s=input()
cnt=[1 for i in range(26)]

for c in s:
    cnt[ord(c) - ord('a')]+=1
res=1

MOD=10**9+7
for num in cnt:
    res = (res*num)%MOD
res = (res-1+MOD)%MOD
print(res)

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

for i in set(S):
    m *= S.count(i)+1

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

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

l = list(s)
abc = list('abcdefghijklmnopqrstuvwxyz')
ans = 1
for i in range(len(abc)):
    cnt = l.count(abc[i])
    if cnt > 0:
        ans = ans*(((cnt + 1))%(10**9 + 7))
ans -= 1
ans = ans %(10**9 + 7)
print(ans)

Solution (Python):
n = input()
s = input()
m=1
for i in set(s):
    m *= s.count(i)+1
print((m-1)%(10**9+7))

Solution (Python):
import numpy as np
 
N = int(input())
S = input()
 
unique_list = list(np.unique(S))
 
ans = 1
 
for s in unique_list:
  tmp = S.count(s)
  ans = ans * (tmp + 1)
  
print((ans-1) % int((1e9 + 7)))

Solution (Python):
import numpy as np

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

unique_list = list(np.unique(S))

ans = 1

for s in unique_list:
  tmp = S.count(s)
  ans = ans * (tmp + 1)
  
print(int((ans-1) % (10**9 + 7)))

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

hist = {}
out = 0
for c in "abcdefghijklmnopqrstuvwxyz":
    hist[c] = 1
for c in S:
    hist[c] += 1

tmp = 1
for a in hist.values():
    tmp *= a
out = (tmp -1) % (10**9 + 7)
print(out)

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

Solution (Python):
N = int(input())
S = input().rstrip()
dic = {}

for i in range(len(S)):
    if S[i] in dic.keys():
        dic[S[i]] += 1
    else:
        dic[S[i]] = 2

ans = 1
for key in dic.keys():
    ans *= dic[key]

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

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

li = [1]*26
for i in S:
    li[ord(i)-97]+=1
ans=1
for i in li:
    ans*=i
print((ans-1)%(10**9+7))

Solution (Python):
n = int(input())
 
s = input()
 
x = []
 
for i in range(n):
    x.append(s[i])
 
import collections
 
clist = collections.Counter(x)
 
y = list(clist.values())
 
cnt = 1
 
for item in y:
    cnt = cnt * (item + 1)
 
cnt = cnt - 1
cnt = cnt % (10 ** 9 + 7)
print(cnt)

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

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

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

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']
count = [1]*26

for n  in range(N):
    for a in range(26):
        if S[n] == alp[a]:
            count[a] += 1

ans = 1
for a in range(26):
    ans *= count[a]
    ans %= 10**9+7

ans -= 1

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

Solution (Python):
from collections import defaultdict

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

A=defaultdict(int)
mod = 10**9+7

for i in range(N):
    A[S[i]]+=1

ans=1
for d,i in A.items():
    ans *= (i+1)
    ans %= mod

print(ans-1)

Solution (Python):
M= 10**9+7
ans = 1

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

for i in S_set:
    ans *= (S.count(i)+1)

print((ans-1) % M)

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

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

Solution (Python):

alphabet = "abcdefghijklmnopqrstuvwxyz"
indmap = {}
for i, c in enumerate(alphabet):
    indmap[c] = i

MOD = 10**9 + 7

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

    counts = [0]*26
    for c in s:
        counts[indmap[c]] += 1

    
    total = 1
    for k in counts:
        total *= (k+1)

    print((total-1) % MOD)

if __name__ == "__main__":
    main()

Solution (Python):
from collections import Counter

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

count = 1
for value in Counter(S).values():
  count *= (value+1)
count -= 1

print(int(count % (10**9+7)))

Solution (Python):
"""Colorful Subsequence"""
N=int(input())
S=input()
result = 1
"""英小文字は26個あるのでaをord()でUnicode変換し、26文字分繰り返す。
        その後chr()でUnicodeから文字に変換し直しているのをcに入れている"""
for c in [chr(ord('a') + i) for i in range(26)]:
    result = (result * (S.count(c) + 1)) % (10**9 + 7)
result = (result - 1) % (10**9 + 7)
print(result)

Solution (Python):
N = int(input())
S = input()
count_list=[]
for i in list(set(S)):
    count_list.append(S.count(i))
product=1
for i in count_list:
    product = (product*(i+1))%(1000000007)
print(int(product-1))

Solution (Python):
from collections import Counter

n=int(input())
s=input()
cnts = list(Counter(s).values())
ans = 1
for i in cnts:
    ans*=i+1
print(ans-1 if (ans-1)<(10**9+7) else (ans-1)%(10**9+7))

Solution (Python):
input()
string = input()
ans = 1
for n in set(string):
    ans *= string.count(n) + 1
print((ans - 1) % (1000000007))

Solution (Python):



from functools import reduce
from operator  import mul

N = int(input())
S = input()
assert N == len(S)


C = set(S)
numOf = {c: sum(1 for s in S if s == c) for c in C}


nSeq = reduce(mul, (n + 1 for n in numOf.values()))
nSeq -= 1  

print(nSeq % (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 = ans * (v + 1) % MOD

print(ans - 1)

Solution (Python):
N = int(input())
S = input()
lis = list(S)
k = 1
se = set(lis)
for item in se:
  l = lis.count(item)
  k = k*(l + 1)
print((k - 1)%(10**9 + 7))

Solution (Python):


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

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

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

print((ans - 1) % int(1e9 + 7))

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

Solution (Python):
from collections import Counter

mod = 10**9 + 7
n = int(raw_input())
s = raw_input()
cc = Counter(s)

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

Solution (Python):

import sys



def solve(lines):
    N = int(lines.pop(0))
    S = lines.pop(0)
    res = 1
    for c in [chr(i) for i in range(97,97+26)]:
        n = S.count(c)
        if n > 0:
            res *= n + 1
    print((res - 1) % 1000000007)


lines = [x.strip() for x in sys.stdin.readlines()]




solve(lines)

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

C = Counter(S).items()

ans = 1
modulo = 10**9+7
for ck,cv in C:
    ans *= cv+1
    ans %= modulo

print(ans-1)

Solution (Python):
KIND = 26
l=int(input())
s=input()

alpha_list = []
for i in range(0, KIND):
    alpha_list.append(0)

for i in s:
    alpha_list[ord(i)-ord('a')] += 1

ret = 1
for num in alpha_list:
    ret *= (num + 1)
print((ret-1)%(1000000000+7))

Solution (Python):
N = int(input())
S = input()
  
co = 0
index =0
n =[]
str = ""

for i in range(N):
  index=str.find(S[i])
  if index == -1 :
    str += S[i]
    n.append(2)
  else :
    n[index] += 1

co = 1
for i in range(len(n)):
  co = co * n[i]
co -= 1

print(co % 1000000007)

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

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

count = 1

for i in range(ord('a'),ord('a')+26):
    count *= s.count(chr(i)) + 1

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

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

ans = 1

for c in set(s):
    ans *= s.count(c) + 1

ans -= 1

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

Solution (Python):


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

ans = 1

for c in set(s):
    ans *= s.count(c) + 1

ans -= 1

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

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

Solution (Python):
from sys import exit
MOD = 10**9 + 7
L = int(input())

S = str(input())
dic = {}
for s in S:
    if not s in dic:
        dic[s] = 1
    else:
        dic[s]+=1
ans =1
for d in dic.keys():
    ans*=dic[d]+1
print((ans-1)%MOD)

Solution (Python):
input()

S=input()

a=set(S)
m=1
for i in a:
    m*=S.count(i)+1

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

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

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

Solution (Python):
from sys import stdin
N=int(input())
S=list(input().strip())
ans=1
for i in set(S):
    ans=ans*(S.count(i)+1)
ans-=1
print(ans%(10**9+7))

Solution (Python):
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    input_raw = read_func().strip().split()
    S = input_raw[0]
    dic = {}
    for s in S:
        if s not in dic:
            dic[s] = 1
        else:
            dic[s] += 1

    count = 1L
    for s in dic:
        count =  (count * long(dic[s] + 1)) % 1000000007L

    count = (count - 1) % 1000000007L
    print count


if __name__ == '__main__':
    main()

Solution (Python):

import sys

MOD = 1000000007  

def solve(n, s):
    counts = {}
    for c in s:
        if c in counts:
            counts[c] += 1
        else:
            counts[c] = 1
    nums = counts.values()
    ret = 1
    for num in nums:
        ret *= num + 1
        ret %= MOD
    ret -= 1
    print(ret)
    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):
import sys
import pprint

N = sys.stdin.readline()
S = sys.stdin.readline()

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




mydict = {}

for x in range(N):
	if S[x] in mydict:
		mydict[S[x]] += 1
	else:
		mydict[S[x]] = 1



count_1 = 0
c = 1

for k in mydict:
		c *= mydict[k] + 1


print((c - 1) % (10**9 + 7), end="")

Solution (Python):
n = int(input())
st = input()
di = {}
for i in range(len(st)):
    if st[i] in di:
        di[st[i]] = di.get(st[i]) + 1
    else:
        di[st[i]] = 2
from functools import reduce
print((reduce(lambda x,y:x*y,di.values())-1)%1000000007)

Solution (Python):
import collections
n=int(input())
S=input()
alphabet=[chr(ord('a') + i) for i in range(26)]
kaisu=collections.Counter(S)
ans=1
for i in alphabet:
	if kaisu[i]!=0:
		ans*=kaisu[i]+1
	ans=ans%(10**9+7)
ans-=1
print(ans)

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

words = {}

for s in S:
    if s in words.keys():
        words[s] += 1
    else:
        words[s] = 2

res = 1
for k in words.keys():
    res *= words[k]

print((res - 1) % 1000000007)

Solution (Python):
from sys import stdin
N=int(stdin.readline().rstrip())
S=(stdin.readline().rstrip())
S=list(S)
ans=1
for i in set(S):
    ans=ans*(S.count(i)+1)
ans-=1
print(ans%(10**9+7))

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

a={}
for i in s:
  if i in a:
    a[i]+=1
  else:
    a[i]=1
j=1
for k in a:
  i=a[k]
  j*=i+1
print((j-1)%(10**9+7))

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

d = {}
for c in s:
  if c not in d.keys():
    d[c] = 2
  else:
    d[c] += 1

ret = 1
for key in d.keys():
  ret *= d[key]

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

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

count=[]
for i in range(26):
	count.append(1)

for i in s:
	if i == "a":
		count[0]=count[0]+1
	elif i == "b":
		count[1]=count[1]+1
	elif i == "c":
		count[2]=count[2]+1
	elif i == "d":
		count[3]=count[3]+1
	elif i == "e":
		count[4]=count[4]+1
	elif i == "f":
		count[5]=count[5]+1
	elif i == "g":
		count[6]=count[6]+1
	elif i == "h":
		count[7]=count[7]+1
	elif i == "i":
		count[8]=count[8]+1
	elif i == "j":
		count[9]=count[9]+1
	elif i == "k":
		count[10]=count[10]+1
	elif i == "l":
		count[11]=count[11]+1
	elif i == "m":
		count[12]=count[12]+1
	elif i == "n":
		count[13]=count[13]+1
	elif i == "o":
		count[14]=count[14]+1
	elif i == "p":
		count[15]=count[15]+1
	elif i == "q":
		count[16]=count[16]+1
	elif i == "r":
		count[17]=count[17]+1
	elif i == "s":
		count[18]=count[18]+1
	elif i == "t":
		count[19]=count[19]+1
	elif i == "u":
		count[20]=count[20]+1
	elif i == "v":
		count[21]=count[21]+1
	elif i == "w":
		count[22]=count[22]+1
	elif i == "x":
		count[23]=count[23]+1
	elif i == "y":
		count[24]=count[24]+1
	elif i == "z":
		count[25]=count[25]+1

result=1
for i in count:
	result=result*i

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

Solution (Python):
import collections
N = int(input())
S = input()
S = collections.Counter(S)
ans = 1
for i in S.values():
    ans *= i + 1
print((ans -1) % 1000000007)

Solution (Python):
N = int(input())
S = list(input())
dic = {}
MOD = 10 ** 9 + 7
for s in S:
    dic.setdefault(s, 1)
    dic[s] += 1
all = 1
for k, v in dic.items():
    all = all * v
print((all -1) % MOD)

Solution (Python):
from collections import defaultdict

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

mod = int(1e9+7)

c_map = defaultdict(int)
for c in s:
    c_map[c] += 1

ans = 1
for cnt in c_map.values():
 	if cnt == 1:
 		ans *= 2
 	else:
 		ans *= (cnt+1)

 	if ans > mod:
 		ans %= mod

print(ans-1)

Solution (Python):
N = int(input())
S = input()
L = [chr(ord('a') + i) for i in range(26)]
cnt = [0]*26
for i in range(len(S)):
  cnt[ord(S[i])-97] += 1
D = []
for i in range(26):
  if cnt[i] != 0:
    D.append(cnt[i])
ans = 1
for i in range(len(D)):
  ans *= (D[i]+1)
  ans = ans%(10**9+7)
print((ans-1)%(10**9+7))

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

Solution (Python):
input()
s = input()
ans = 1
for i in range(97, 123):
    ans *= s.count(chr(i)) + 1
print((ans-1) % (10**9+7))

Solution (Python):
input()
s = list(input())
d = {chr(i):1 for i in range(97, 123)}
for c in s:
    d[c] += 1
ans = 1
for i in d.values():
    ans *= i
print((ans-1) % (10**9+7))

Solution (Python):

N = int(input())
S = input()
mod = 1000000000 + 7
alpha = list(map(chr,range(97,123)))
ans = 1
for i in alpha:
    ans *= S.count(i) + 1
print(int((ans-1) % mod))

Solution (Python):



from collections import Counter

def solveProblem(S):
	
	
	
	
	stringCounterBox = Counter(S)
	
	maxStrLength = len(stringCounterBox)
	
	countList = list(stringCounterBox.values())
	
	'''
	戦略
	リストに入った数値に1足した物を掛けて行く。最後に1を引いたのが答え。
	根拠
	このabcの時を例に出すとa,b,cの3字について
	a→0回～2回出す
	b→aと同じ
	c→0回～1回出す
	ケースの組み合わせを考えると 3 * 3 * 2 = 18通りある
	しかし 全ての文字0回という選択をすると文字列そのものが無くなってしまう。
	この場合は対象外となるので1減らす。
	'''
	counter = 1
	for i in range(0,len(countList),+1):

		
		counter = (counter*(countList[i]+1)) % (pow(10,9)+7)

	answer = counter-1
	return answer


if __name__ == '__main__':
	_ = int(input().strip())
	S = str(input().strip())
	solution = solveProblem(S)
	print("{}".format(solution))

Solution (Python):






N = int(input())
S = input()
assert N == len(S)


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


nSeq = 1
for c in numOf:
    nSeq *= numOf[c] + 1  
nSeq -= 1  

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

Solution (Python):



from collections import Counter

def solveProblem(S):
	
	SSorted = sorted(S)
	
	stringCounterBox = Counter(SSorted)
	
	maxStrLength = len(stringCounterBox)
	
	
	countList = list(stringCounterBox.values())
	
	
	'''
	戦略
	1個の時→1個の配列を取り出した物を足す→2 + 2 + 1 = 5
	2個の時→取り出す文字は文字毎に数字だけパターンが替わる→ 2*2 + 2*1 + 2* 1 = 8
	3個の時 同上→ 2*2*1 = 4
	これ以上の取り出しはもう出来ない:同じ文字が出てくるため
	5 + 8 + 4 = 17 と答えと一致した
	TODO 取り出す配列番号を調べる方法が不明
	この場合なら2個の時0番目と1番目,0番目と2番目,1番目と2番目を洗い出すのはどうするのか？
	偉い人の回答待ち
	'''
	counter = 1
	for i in range(0,len(countList),+1):

		
		counter = (counter*(countList[i]+1)) % (pow(10,9)+7)

	answer = counter-1
	return answer


if __name__ == '__main__':
	_ = int(input().strip())
	S = str(input().strip())
	solution = solveProblem(S)
	print("{}".format(solution))

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

MOD = 1000000007

atoz = list(map(chr,range(97,123)))
cd = dict()
for c in atoz:
    cd[c] = 0

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

ans = 1
for val in cd.values():
    if val == 0: continue
    ans = ans * (val + 1)
    ans %= MOD

ans -= 1
ans %= MOD

print(ans)

Solution (Python):
from collections import Counter

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

r = 1
for m in Counter(S).values():
    r = r * (m+1) % (10**9+7)

print(r-1)

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

from collections import Counter

cs = Counter(S)

M = 10**9 + 7

result = 1
for c in cs:
    result = result * (cs[c] + 1)

result = (result - 1) % M

print(result)

Solution (Python):

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

from collections import Counter
c = Counter(S)
mod = 10**9 + 7
ans = 1

allc = "abcdefghijklmnopqrstuvwxyz"
for ch in allc:
    ans = ans * (c[ch]+1) % mod
print(ans-1)

Solution (Python):




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

aprcnt = [1] * 26


for idx in range(n):
    w_idx = ord(s[idx]) - 97
    aprcnt[w_idx] += 1


ans = 1
for idx in range(26):
    ans = ans * aprcnt[idx]


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


print(ans)

Solution (Python):
from collections import Counter

import scipy.misc as scm

n = int(input())
s = list(input())
tmp = len(set(s))
count_s = Counter(s)
count_s = count_s.most_common()
ans = 1
for i in range(tmp):
  if count_s[i][1] > 1:
    ans *= (count_s[i][1]+1)
    ans = ans % (10**9+7)
  else:
    ans *= 2
    ans = ans % (10**9+7)
ans -= 1
print(ans)

Solution (Python):
"""AtCoder"""

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

l = "abcdefghijklmnopqrstuvwxyz"
t = 10**9 + 7

ans = 1

for i in range(len(l)):
    ans *= S.count(l[i]) + 1

print((ans - 1)%t)

Solution (Python):

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

def atoi(a):
    alphabet = ['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']
    return alphabet.index(a)

a_list = [0 for i in range(26)]
for i in range(N):
    a_list[atoi(S[i])]+=1
ans = 1
for i in range(26):
    ans *= (a_list[i]+1)
    ans = ans%(10**9 + 7)
if ans>0:
    ans-=1
else:
    ans=10**9 + 6
print(ans)

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

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

Solution (Python):
from collections import Counter
import functools
import operator
input()
print((functools.reduce(operator.mul, [i + 1 for i in list(Counter(input()).values())]) - 1) % (10 ** 9 + 7))

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

Solution (Python):
from collections import Counter

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

mod = 10 ** 9 + 7
ans = 1
for value in S.values():
    ans *= (value + 1)

print((ans - 1) % mod)

Solution (Python):
from sys import exit

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


def get_count():
    count = 1

    m = {}

    for s in S:
        if s in m.keys():
            m[s] += 1
        else:
            m[s] = 1

    for k in m:
        count *= m[k] + 1

    count -= 1

    return count


ans = get_count() % (10 ** 9 + 7)

print(ans)

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m
    
    def add(self, a, b):
        return (a + b ) % self.m

    def sub(self, a, b):
        return (a - b) % self.m
    
    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, self.pow(b, self.m-2))

    def pow(self, x, y):
        if y == 0: 
            return 1
        elif y == 1: 
            return x % self.m
        elif y % 2 == 0: 
            return self.pow(x, y//2)**2 % self.m
        else: 
            return self.pow(x, y//2)**2 * x % self.m



@mt
def slv(N, S):
    CC = defaultdict(lambda: 1)
    for c in S:
        CC[c] += 1
    
    m = Mod(10**9+7)
    return reduce(m.mul, CC.values()) - 1


def main():
    N = read_int()
    S = read_str()
    print(slv(N, S))


if __name__ == '__main__':
    main()

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m
    
    def add(self, a, b):
        return (a + b ) % self.m

    def sub(self, a, b):
        return (a - b) % self.m
    
    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, self.pow(b, self.m-2))

    def pow(self, x, y):
        if y == 0: 
            return 1
        elif y == 1: 
            return x % self.m
        elif y % 2 == 0: 
            return self.pow(x, y//2)**2 % self.m
        else: 
            return self.pow(x, y//2)**2 * x % self.m



@mt
def slv(N, S):
    CC = Counter()
    for c in S:
        CC[c] += 1

    for c in CC:
        CC[c] += 1
    
    m = Mod(10**9+7)
    return reduce(m.mul, CC.values()) - 1


def main():
    N = read_int()
    S = read_str()
    print(slv(N, S))


if __name__ == '__main__':
    main()

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

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

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

ans = 1
for i in D.values() :
    ans *= (i+1)
ans -= 1
ans %= 10**9+7
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 key in d:
  ans*=d[key]+1
  ans%=MOD
print(ans-1)

Solution (Python):
from collections import defaultdict


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

M = 10**9 + 7
count_dict = defaultdict(int)

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

ans = 1
for v in count_dict.values():
    ans *= (v + 1)
    ans %= M

print(ans - 1)

Solution (Python):
from collections import Counter
N = int(input())
S = input()
answer = 1
counter = Counter(S).most_common()

for i in range(len(counter)):
    answer = answer * (counter[i][1] + 1) % (10**9 + 7)

print(answer-1)

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

M = 10**9 + 7
cnt = [0] * 26

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

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

print(ans - 1)

Solution (Python):

import sys
import collections

def main():
	N = int(input())
	S = input()
	tmp = list(S)
	
	strings = collections.Counter(tmp)
	
	ans = 1
	for key in strings:
		ans = ans * (strings[key] + 1)
	
	ans = (ans-1) % (1000000007)
	
	print(ans)
			
if __name__ == "__main__":
	main()

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

s_dict = {}
for s in S:
    if s in s_dict:
        s_dict[s] += 1
    else:
        s_dict[s] = 2

ans = 1
for val in s_dict.values():
    ans *= val
print((ans-1)%div)

Solution (Python):
N = int(input())
S = input()
charCount = {}
for c in S:
  if c not in charCount:
    charCount[c] = 1
  else:
    charCount[c] += 1

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

Solution (Python):
N = int(input())
S = input()
alphabet = "abcdefghijklmnopqrstuvwxyz"

ans = 1
for char in alphabet:
    count_char = S.count(char) + 1
    ans *= count_char
ans -= 1
ans %= (10**9+7)

print(ans)

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

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

M = 10**9 + 7
cnt = [0] * 26

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

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

print(ans - 1)

Solution (Python):
n = int(input())
s = list(map(str,input()))
count = 1
unique = list(set(s))
for i in unique:
    count *= (s.count(i) + 1)
count -=1
print(count % (10**9 + 7))

Solution (Python):
from string import ascii_lowercase
from functools import reduce
from operator import mul


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


ans = (
    reduce(
        mul,
        map(
            lambda c: S.count(c) + 1,
            ascii_lowercase
        )
    ) - 1
) % (10**9 + 7)


print(ans)

Solution (Python):
from string import ascii_lowercase
from functools import reduce
from operator import mul


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


ans = (
    reduce(
        mul,
        map(
            lambda c: S.count(c) + 1,
            ascii_lowercase
        )
    )
    - 1
) % (10**9 + 7)


print(ans)

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

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

Solution (Python):
import sys


N=int(input())
s=input()
def find(s):
    dic={}
    for x in s:
        if x in dic:
            dic[x]+=1
        else:
            dic[x]=1

    MOD=10**9+7
    ans=1
    for x in dic:
        ans*=dic[x]+1
        ans%=MOD
    return (ans-1)%MOD

print(find(s))

Solution (Python):
def main():
    input()
    s=input()
    import collections
    c = collections.Counter(s)
    
    ans = 1
    MOD = 10**9 + 7
    for n in c.values():
        ans *= (n+1)
        ans %= MOD
    ans -= 1
    ans %= MOD
    print(ans)


if __name__ == '__main__':
    main()

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

A=["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"]
L=[1 for i in range(26)]


for i in range(len(S)):
    for j in range(26):
        if S[i]==A[j]:
            L[j]+=1
ans=1            
for i in range(26):
    ans*=L[i]
    ans%=10**9+7
print(ans-1)

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

dic = {}
for s_i in set(s):
	dic[s_i] = s.count(s_i)+1

p = 10**9+7
res = 1
for v in dic.values():
	res = (res*v)%p

print(res-1)

Solution (Python):
n = int(input())
s = input()
a = list('abcdefghijklmnopqrstuvwxyz')
cnt = [0]*26
for i,a_ in enumerate(a):
    cnt[i] += s.count(a_)+1
ans = 1
for cnt_ in cnt:
    ans *= cnt_
print(ans%int(1e9+7)-1)

Solution (Python):
n = int(input())
s = input()
a = list('abcdefghijklmnopqrstuvwxyz')
cnt = [0]*26
for i,a_ in enumerate(a):
    cnt[i] += s.count(a_)+1
ans = 1
for cnt_ in cnt:
    ans *= cnt_
print(ans%(10**9+7)-1)

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

Solution (Python):
from collections import Counter

n = int(input())
S = list(input())

X = Counter(S)

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

print(ans-1)

Solution (Python):
from collections import Counter
from sys import stdin

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

    cnt = Counter(S)
    ans = 1
    for i in cnt.values():
        ans *= i + 1
        ans %= 1000000007
    print(ans - 1)

input = lambda: stdin.readline().rstrip()
main()

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

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

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

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

c = Counter(s)
res = 1
for e in c.values():
    res = res*(e+1)%mod
print(res-1)