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):

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


if __name__ == "__main__":
    main()

Solution (Python):

from functools import reduce


def main():
    _ = int(input())
    S = input().rstrip()
    MOD = 10 ** 9 + 7
    C = [S.count(i) + 1 for i in set(S)]
    ans = reduce(lambda x, y: (x * y) % MOD, C)
    print(ans - 1)


if __name__ == "__main__":
    main()

Solution (Python):

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


if __name__ == "__main__":
    main()

Solution (Python):

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


if __name__ == "__main__":
    main()

Solution (Python):
a = int(input())
b = input()
c = {}
for i in range(a):
    if b[i] not in c:
        c[b[i]] = 1
    else:
        c[b[i]] += 1
d = 1
for k in c.keys():
    d = (d * (c[k] + 1)) % (10 ** 9 + 7)
print(d - 1)

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




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


char_list = list(char_dict.values())
char_num = len(char_list)



ans = 1
for i in char_list:
    ans *= i + 1
    ans %= mod

print(ans-1)

Solution (Python):
a = int(input())
b = input()
c = {}
for i in range(a):
    if b[i] not in c:
        c[b[i]] = 1
    else:
        c[b[i]] += 1
d = 1
for k in c.keys():
    d = (d * (c[k] + 1)) % (10 ** 9 + 7)
d -= 1
print(d)

Solution (Python):
S=input()
S=input()
ans=1
c=[1]*26
for i in S:
        c[ord(i)-ord('a')]+=1
for i in c:
        ans*=i
print(ans%1000000007-1)

Solution (Python):
a = int(input())
b = list(input())
c = {}
for i in range(a):
    if b[i] not in c:
        c[b[i]] = 1
    else:
        c[b[i]] += 1
ans = 1
for v in c.values():
    ans *= (v + 1)
print((ans - 1) % (10 ** 9 + 7))

Solution (Python):
n = input()
s = list(input())
import collections
s = collections.Counter(s)
s = s.most_common()
ans = 1
for i in s:
  ans *= i[1]+1
  
print((ans-1)%1000000007)

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt, ceil, floor
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
import heapq
INF = float("inf")
MOD = 10**9 + 7
sys.setrecursionlimit(10**7)

dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
def inside(y: int, x: int, H: int, W: int) -> bool: return 0 <= y < H and 0 <= x < W
def mi(): return map(int, input().split())
def ii(): return int(input())


N = ii()
S = input()
num = [0 for _ in range(26)]

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


ans = 1
for each in num:
  ans *= (1 + each)
  ans %= MOD

print(ans - 1)

Solution (Python):
from collections import Counter

MOD = 10**9 + 7

N = int(input())
Ss = input()

cnt = Counter(Ss)

ans = 1
for key, num in cnt.items():
    ans *= num+1
    ans %= MOD

print(ans-1)

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

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

MOD = int(1e9) + 7

d = {}
for i in range(N):
    if S[i] in d:
        d[S[i]] += 1
    else:
        d[S[i]] = 1

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

Solution (Python):
from sys import stdin

N = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

inf = 10 ** 9 + 7
ans = 1

alphabet = [x for x in 'abcdefghijklmnopqrstuvwxyz']
count = [1 for _ in range(26)]

for i in range(len(s)):
    count[alphabet.index(s[i])] += 1

for j in count:
    ans = ans * j % inf

print(ans - 1)

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

d = {}
for i in s:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1


ans = 1
for i in d:
    ans *= d[i]+1

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

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

char2count = {}
for s in S:
    if s not in char2count:
        char2count[s] = 0
    char2count[s] += 1

total = 1
for x in char2count.values():
    total *= (x + 1)
print((total - 1) % (1000000000 + 7))

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

from collections import Counter

counter = Counter(list_s)

LARGE_NUM = 10**9 + 7

result = 1
for _, cnt in counter.items():
    result *= cnt+1
    result %= LARGE_NUM
print(result-1)

Solution (Python):

from collections import defaultdict, deque
import math
from math import factorial
import re

BIGNUM = 10 ** 9 + 7

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

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

    result = 1
    for n in nums.values():
        result *= (n + 1)
        result = result % BIGNUM
    result = (result - 1) % BIGNUM
    print(result)

if __name__ == '__main__':
    main()

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

count = [1] * 26

for i in range(n):
	temp = ord(s[i]) -  ord("a")
	count[temp] += 1

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

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

Solution (Python):
from collections import Counter

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

nums = Counter(S).most_common()

mod = 10 ** 9 + 7
cnt = 1
for i, j in nums:
    cnt *= (j + 1)
    cnt %= mod

print(cnt - 1)

Solution (Python):
from collections import Counter

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

nums = Counter(S).most_common()

mod = 10 ** 9 + 7
cnt = 1
for i, j in nums:
    cnt *= (j + 1)
    cnt %= mod

print((cnt - 1) % mod)

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

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

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

ans = 1
for n in num.values():
    ans = int(ans * (n+1) % (1E9+7))

ans -= 1

print(ans)

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

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

print((ans-1)%1000000007)

Solution (Python):
n=int(input())
ss=input()
mod=1000000007
s=[]
for i in range(n):
    s.append(ss[i])
s.sort()
x=s[0]
l=[]
count=1
for i in range(1,n):
    if x==s[i]:
        count+=1
        if i==n-1:
            l.append(count%mod)
    else:
        l.append(count%mod)
        count=1
        x=s[i]
        if i==n-1:
            l.append(count%mod)

y=len(l)
m=1

for i in range(y):
    m=m*(l[i]+1)%mod
print((m-1)%mod if n>1 else 1)

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

l = []
cnt = []
for i in s:
    x = 0
    if i not in l:
        l.append(i)
        x = s.count(i)
        cnt.append(x)

ans = 1
if n == 1:
    print(ans)
else:
    for x in cnt:
        if x == 1:
            ans *= 2
        else:
            ans *= (x+1)
    print((ans-1)%MOD)

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

c = Counter(S)

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

Solution (Python):
from collections import Counter

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

a = Counter(S)
ans = 1
for i in a.keys():
    ans *= (a[i]+1)

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

Solution (Python):
n,s=int(input()),sorted(list(input()))
count=[]
cnt=0
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
    else:
        count.append(cnt+2)
        cnt=0
count.append(cnt+2)
ans=1
for i in range(len(count)):
    ans*=count[i]
    ans%=10**9+7
print(ans-1)

Solution (Python):
import collections as c;from functools import reduce as r;n=input()
print(r(lambda x,y:x*y,[i+1 for i in list((c.Counter(input())).values())])%(10**9+7)-1)

Solution (Python):
import collections as c
n=int(input())
s=input()
a=[i+1 for i in list((c.Counter(s)).values())]
f=1
for i in range(len(a)):
  f=(f*a[i])%(10**9+7)
print(f-1)

Solution (Python):
n = input()
s = input()
mod = 10**9+7
chara_list = [1 for i in range(26)]
for i in s:
    chara_list[ord(i)-97] += 1


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

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

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

cnt = [S.count(a) for a in ascii_lowercase]

print(reduce(lambda x, y: x * (y + 1) % (10 ** 9 + 7), cnt, 1) - 1)

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

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

mod=10**9+7
ans=1

t='abcdefghijklmnopqrstuvwxyz'


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

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

Solution (Python):
from collections import Counter

n = int(input())
s = input()
counter = Counter(s)
ans = 1

for char, count in counter.items():
    if count != 1:
        ans = ans * (count + 1) % (10 ** 9 + 7)
    else:
        ans = ans * 2 % (10 ** 9 + 7)
print(ans - 1)

Solution (Python):
from collections import Counter

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

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

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

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

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

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

answer = x - 1
print(answer%MOD)

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

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

char_num = Counter(list(S))
cnt = reduce(mul, [c+1 for c in char_num.values()]) - 1
print(cnt % (10**9+7))

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

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

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

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

Solution (Python):
from collections import *
from functools import *

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

counter_s = map(lambda x: x + 1, Counter(s).values())
ans = reduce(lambda x, y: (x * y) % (10 ** 9 + 7), counter_s)

print(ans - 1)

Solution (Python):
from collections import *
from functools import *

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

counter_s = [i[1] + 1 for i in Counter(s).most_common()]
ans = reduce(lambda x, y: (x * y) % (10 ** 9 + 7), counter_s)

print(ans - 1)

Solution (Python):
from collections import *
from operator import *

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

counter_s = Counter(s).most_common()
ans = 1
for i in counter_s:
    ans = (ans * (i[1] + 1)) % (10 ** 9 + 7)

ans -= 1
print(ans)

Solution (Python):
from functools import reduce

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

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

cnt = {}
for b in input():
    cnt[b] = cnt[b] + 1 if b in cnt else 2

print(reduce(mul, cnt.values()) - 1)

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

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

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

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

Solution (Python):
from functools import reduce
N = int(input())
DIV = 10**9 + 7
S = {chr(i): 0 for i in range(ord('a'), ord('z') + 1)}
for c in input():
    S[c] += 1
print(reduce(lambda acc, n: acc * (n + 1) % DIV, S.values(), 1) - 1)

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

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

Solution (Python):
import collections as cl


N = int(input())
S_lst = list(input())

counter_dic = dict(cl.Counter(S_lst))

ans = 1
for i in counter_dic.values():
    ans *= i + 1

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

print(ans)

Solution (Python):
from collections import defaultdict

N=int(input())
S=input()
INF=int(1e9+7)
dict=defaultdict(int)
for i in S:
    dict[i]+=1
l=list(dict.values())
ans=1
for i in l:
    ans*=(i+1)
    ans%=INF
print(ans-1)

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

Solution (Python):
N = input()
c = [1]*("z".encode()[0]-"a".encode()[0]+1)
for x in map(lambda x: x-"a".encode()[0], input().encode()):
	c[x] += 1

m = 1
for x in c:
  m = (m * x) % (1e9+7)

print("{:.0f}".format(m-1))

Solution (Python):
n = int(input())
s = input()
N = 10 ** 9 + 7
d = {}

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

ans = 1

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

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

Solution (Python):
from sys import stdin
from collections import Counter
N = int(stdin.readline().rstrip())
S = Counter(stdin.readline().rstrip()).most_common()
MOD = 10**9+7
ans = 1
for k, v in S:
    ans *= (v+1)
    ans %= MOD
print(ans-1)

Solution (Python):
from collections import Counter
MOD = 10**9 + 7
n = int(input())
s = input().rstrip()
cnt = Counter(s)
ans = 1
for key in cnt.keys():
    ans *= (cnt[key] + 1)
    ans %= MOD
print(ans - 1)

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

char_dic = {}
for i in range(N):
  char = S[i]
  if char not in char_dic:
    char_dic[char] = 2
  else:
    char_dic[char] += 1
    
prod = 1
for key in char_dic:
  prod *= char_dic[key]
  
print((prod-1)%(10**9+7))

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

alp = "qwertyuiopasdfghjklzxcvbnm"

ans = 1

for c in alp:
    n = 0
    for i in range(N):
        if S[i] == c:
            n += 1
    ans *= n+1
    ans = ans % MOD
    
print(ans-1)

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):
def solve():
    N = int(input())
    S = input()
    MOD= int(1e9)+7

    from collections import Counter
    c = Counter(S)
    ans = 1
    for k in c.keys():
        ans = (ans * (c[k] + 1)) % MOD
    ans = (ans - 1) % MOD

    print(ans % MOD)

if __name__ == "__main__":
    solve()

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

p = 1
ccnt = [0]*26
MOD = 10**9 + 7

for i in range(N):
    index = ord(S[i])-ord("a")
    ccnt[index] += 1
for i in range(26):
    ccnt[i] += 1

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

print(ans-1)

Solution (Python):
from collections import Counter
n=int(input())
s=input()
sc=Counter(s).most_common()
ans=1
for i,j in sc:
    ans=ans*(j+1)%1000000007
print(ans-1)

Solution (Python):
N = int(input())
S = input()
alphabets = "abcdefghijklmnopqrstuvwxyz"
ans = 1
for alphabet in alphabets:
    cnt = S.count(alphabet)
    ans *= (cnt+1)
ans -= 1
print(ans%(10**9+7))

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

Solution (Python):

from sys import stdin



from collections import Counter

def _li(): return list(map(int, stdin.readline().split()))
def _li_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def _lf(): return list(map(float, stdin.readline().split()))
def _ls(): return stdin.readline().split()
def _i(): return int(stdin.readline())
def _f(): return float(stdin.readline())
def _s(): return stdin.readline()[:-1]


MOD = 10**9 + 7
N = _i()
S = list(_s())

s_count = Counter(S)
ans = 1
for _, i in s_count.items():
    ans *= (i+1)
    ans %= MOD
print((ans - 1) % MOD)

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


prod = 1
for char in set(s):
    num = s.count(char)
    prod *= (num + 1)

print((prod - 1) % (pow(10, 9) + 7))

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


def char_to_int(c):
    return ord(c) - 97


char_counts = [0 for _ in range(26)]
for c in S:
    i = char_to_int(c)
    char_counts[i] = char_counts[i] + 1

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

Solution (Python):

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


prod = 1
for char in set(s):
    num = s.count(char)
    prod *= (num + 1)

print((prod - 1) % (pow(10, 9) + 7))

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

Solution (Python):
n = int(input())
s = str(input())
l = []
for x in s:
    if x not in l:
        l.append(x)
ans = 1
for x in l:
    ans = ans*(s.count(x)+1)
ans -= 1
ans = ans%(10**9 + 7)
print(ans)

Solution (Python):
N=int(input())
S=input()
MOD=10**9+7
count_char={}
for s in S:
    if s not in count_char:
        count_char[s]=1
    else:
        count_char[s]+=1
ans=1
for k,ct in count_char.items():
    ans*=ct+1
    ans%=MOD
ans+=MOD-1
ans%=MOD
print(ans)

Solution (Python):

from collections import defaultdict

def main():
    num = int(input())
    data = list(input())

    count_dic = defaultdict(int)

    for i in range(num):
        count_dic[data[i]] += 1

    count_list = list(count_dic.values())

    ans = 1
    for ele in count_list:
        ans *= ele + 1

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





if __name__ == '__main__':
    main()

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

print((ans - 1) % mod)

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

print((ans - 1) % mod)

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

c = [1 for i in range(26)]

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

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

print(ans-1)

Solution (Python):
from collections import Counter
c=Counter()
N=int(input())
c=Counter(input())
ans=1
for i,b in c.items():
    if b>1:
        ans*=(b+1)
    else:
        ans*=2
print(int((ans-1)%(10**9+7)))

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

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

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

Solution (Python):
n=int(input())
s=list(input())
s.sort()
cnt=1
cnt_list=[]
if len(s)==1:
    print(1)
    exit()
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
        if i==n-2:
            cnt_list.append(cnt)
    else:
        cnt_list.append(cnt)
        cnt=1
        if i==n-2:
            cnt_list.append(1)
ans=1
for i in range(len(cnt_list)):
    ans=ans*(cnt_list[i]+1)%(10**9+7)
print(ans-1)

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

dic = {}

for i in range(N):
    dic.setdefault(S[i], 0)
    dic[S[i]] += 1
s = list(dic.values())
ans = 1
for i in s:
    ans = ans * (i + 1) % (10 ** 9 + 7)

print(ans - 1)

Solution (Python):
n=int(input())
dic={}
l=list(input())
for i in range(n):
    dic.setdefault(l[i],0)
    dic[l[i]]+=1
s=list(dic.values())
ans=1
mod=10**9+7
for i in s:
    ans*=(i+1)%mod
print((ans-1)%mod)

Solution (Python):
def colorful_subsequence(N: int, S: str)->int:
    MOD = (10 ** 9) + 7
    cum = {}
    for c in S:
        cum.setdefault(c, 0)
        cum[c] += 1

    values = list(cum.values())
    count = 1
    for v in values:
        count *= (1 + v)
        count %= MOD

    return (count-1) % MOD


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

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

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

appear={}

for i in range(N):
  appear.setdefault(S[i],0)
  appear[S[i]]+=1

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

Solution (Python):
n = int(input())
s = input()
alphabet = "abcdefghijklmnopqrstuvwxyz"
ans = 1

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

Solution (Python):
n=int(input())
s=input()
cnt=[0]*26
cnt2=[]
ans=1
check='abcdefghijklmnopqrstuvwxyz'
for i in range(n):
  for j in range(26):
    if s[i]==check[j]:
      cnt[j]+=1
      break
for i in range(26):
  if cnt[i]!=0:
    cnt2.append(cnt[i])
for i in range(len(cnt2)):
  ans*=(cnt2[i]+1)
  ans=ans%(10**9+7)
print(ans-1)

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

mod = 10**9+7
query = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(26):
    if s.count(query[i]) >= 1:
        ans *= 1 + s.count(query[i])
        ans %= mod
print((ans-1)%mod)

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

nums = {}
for s in S:
    if not s in nums:
        nums[s] = 0
    nums[s] += 1
ans = 1
for n in nums.values():
    ans *= (n + 1)
    ans %= int(1e9 + 7)
ans = (ans + int(1e9 + 7 - 1)) % int(1e9 + 7)

print(ans)

Solution (Python):
num=int(input())
string=input()
string=list(string)
mod=10**9+7
alpha=[0]*26
res=1
for s in string:
  alpha[ord(s)-97]+=1
for k in alpha:
  res*=(k+1)
print((res-1)%mod)

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

c = collections.Counter(s)

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

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

Solution (Python):
input()
s=input()
d={}
for i in s:
    if i in d:
        d[i]+=1
    else:
        d[i]=2
ans=1
for i in d:
    ans*=d[i]
print((ans-1)%1000000007)

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

Solution (Python):
n = int(input())
s = list(input())
box = []
alfa = [chr(ord('a') + i) for i in range(26)]
ans = 1

for hoge in alfa:
    if hoge in s:
        box.append([hoge, s.count(hoge)])

for hoge in range(len(box)):
    ans *= box[hoge][1] + 1

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

Solution (Python):
_,s=open(0);a=1
for i in set(s):a*=s.count(i)+1
print(a//2%(10**9+7)-1)

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

print((ans-1)%mod)

Solution (Python):
n=int(input())
l=input()
d=dict()
for a in l:
  if not a in d:
    d[a]=1
  else:
    d[a]+=1
ans=1
for a in d.values():
  ans*=a+1
print((ans-1)%(10**9+7))

Solution (Python):
n=int(input())
l=input()
d=dict()
for a in l:
  if not a in d:
    d[a]=1
  else:
    d[a]+=1
ans=1
for a in d.values():
  ans*=a+1
print((ans-1)%(10**9+7))

Solution (Python):


N = int(input())
S = input()
MOD = 1000000007

ans = 1
for e in set(S):
    cnt = 0
    
    for i in range(N):
        if S[i] == e:
            cnt += 1
    ans *= cnt+1
    
print((ans-1) % MOD)

Solution (Python):
cnt = [0] * 26
n = int(input())
s = input()
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):
def solve():
  mod = 10**9+7
  query = 'abcdefghijklmnopqrstuvwxyz'
  n = int(input())
  s = input()
  ans = 1
  for i in range(26):
    if s.count(query[i])>= 1:
     ans *= 1+s.count(query[i])
     ans %= mod
  print((ans-1)%mod)
solve()

Solution (Python):


import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()
S=input()

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

ans-=1
print(ans)

Solution (Python):
from collections import Counter
N, = list(map(int, input().split()))
S = input()
m = 10**9+7
c = Counter(S)
r = 1
for k in c:
  r = (r*(c[k]+1)) % m
print((r-1)%m)

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

n = int(input())

s = input()

dic = {}

for i in s:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1

ans = 1

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

print(ans-1)

Solution (Python):
from collections import defaultdict
dd=defaultdict(int)
N=int(input())
S=input()
for s in S:
    dd[s]+=1
ans=1
mod=10**9+7
for a,n in dd.items():
    ans*=(n+1)
    ans%=mod
print((ans-1)%mod)

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

memo=[1]*26

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

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

print(ans-1)

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

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

dic = {}
for s in "abcdefghijklmnopqrstuvwxyz":
    dic[s] = 0

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

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

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

Solution (Python):



import sys


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

cnt = {}
for c in s:
  if c not in cnt:
    cnt[c] = 1
  else:
    cnt[c] += 1

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

print(ans-1)

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()

cnt = Counter(s)

ans = 1
mod = 10**9+7

for k,v in cnt.items():
    ans *= (v+1)
    ans %= mod
    
ans -= 1
if ans < 0:
    ans += mod
    
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):
N = int(input())
S = input()
MOD = 10**9+7

alp = 'abcdefghijklmnopqrstuvwxyz'
count_alp = [0 for i in range(26)]
count = 1

for s in S:
    count_alp[alp.find(s)]+=1

for i in count_alp:
    count*= (i+1)
print((count-1)%MOD)

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)


def main():
    n = I()
    s = S()
    c = collections.Counter(s)
    r = 1
    for k,v in c.items():
        r *= v + 1
        r %= mod

    return (r-1) % mod


print(main())

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

chars = [1] * 30

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


res = 1
for c in chars:
    res = (res*c)%MOD
res = (res-1)%MOD

print(res)

Solution (Python):
n = int(input())
s = input()
s_set = set(s)
S = []
for i in s_set:
    S.append(s.count(i))

ans = 1
for i in S:
    ans *= i + 1
    ans %= 10 ** 9 + 7

print(ans - 1)

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

s_set = list(set(S))
num = 1

for i in s_set:
  num *= S.count(i)+1
print((num-1)%(10**9+7))

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

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

Solution (Python):
N = int(input())
S = input()
charCnt = []
flag = {}
for c in S:
  if not c in flag:
    flag[c] = 1
    charCnt.append([c,1])
  else :
    flag[c] += 1
    for i in range(len(charCnt)):
      if charCnt[i][0] == c:
        charCnt[i][1] += 1
        break

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