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

Solution (Python):
import sys
class alphabet: 
    def __init__(self, capitalize):
        self.num = dict()
        self.index = dict()
        self.abc = ["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"]
        if capitalize: 
            for i in range(26): self.abc[i] = self.abc[i].upper()
        for i, a in enumerate(self.abc):
            self.num[a] = i
            self.index[i] = a

def solve():
    input = sys.stdin.readline
    N = int(input())
    S = input().strip("\n")
    AB = alphabet(False)
    Count = [1] * 26
    for i in range(len(S)):
        Count[AB.num[S[i]]] += 1
    mod = 7 + 10 ** 9
    Ans = 1
    for i, n in enumerate(Count):
        Ans *= n
        Ans %= mod
    print((Ans - 1 + mod) % mod)


    return 0

if __name__ == "__main__":
    solve()

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

mod = 10**9 +7

d = {}
for i in range(n):
    if s[i] not in d:
        d[s[i]] = 1
    else:
        d[s[i]] += 1

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

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

MOD = 10**9+7
class Mint:
    def __init__(self, value=0):
        self.value = value % MOD
        if self.value < 0: self.value += MOD

    @staticmethod
    def get_value(x): return x.value if isinstance(x, Mint) else x

    def inverse(self):
        a, b = self.value, MOD
        u, v = 1, 0
        while b:
            t = a // b
            b, a = a - t * b, b
            v, u = u - t * v, v
        if u < 0: u += MOD
        return u

    def __repr__(self): return str(self.value)
    def __eq__(self, other): return self.value == other.value
    def __neg__(self): return Mint(-self.value)
    def __hash__(self): return hash(self.value)
    def __bool__(self): return self.value != 0

    def __iadd__(self, other):
        self.value += Mint.get_value(other)
        if self.value >= MOD: self.value -= MOD
        return self
    def __add__(self, other):
        new_obj = Mint(self.value)
        new_obj += other
        return new_obj
    __radd__ = __add__

    def __isub__(self, other):
        self.value -= Mint.get_value(other)
        if self.value < 0: self.value += MOD
        return self
    def __sub__(self, other):
        new_obj = Mint(self.value)
        new_obj -= other
        return new_obj
    def __rsub__(self, other):
        new_obj = Mint(Mint.get_value(other))
        new_obj -= self
        return new_obj

    def __imul__(self, other):
        self.value = self.value * Mint.get_value(other) % MOD
        return self
    def __mul__(self, other):
        new_obj = Mint(self.value)
        new_obj *= other
        return new_obj
    __rmul__ = __mul__

    def __ifloordiv__(self, other):
        other = other if isinstance(other, Mint) else Mint(other)
        self *= other.inverse()
        return self
    def __floordiv__(self, other):
        new_obj = Mint(self.value)
        new_obj //= other
        return new_obj
    def __rfloordiv__(self, other):
        new_obj = Mint(Mint.get_value(other))
        new_obj //= self
        return new_obj

from collections import Counter
C = Counter(S)
ans = Mint(1)
for c in C.values():
    ans *= c + 1
print(ans - 1)

Solution (Python):
from collections import Counter

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

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

print((ans-1)%mod)

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


if __name__ == '__main__':
    main()

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

MOD = 10 ** 9 + 7

from collections import Counter

Scnt = Counter(S)




ans = 1
for cnt in Scnt.values():
    ans = (ans * (cnt + 1)) % MOD

ans -= 1

print(ans)

Solution (Python):
n = int(input())
s = list(input())
mod = 10**9+7
alp = [0] * 26

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

ans = 1
for c in alp:
    if (c != 0):
        ans *= (c+1)

print((ans - 1) % mod)

Solution (Python):
from collections import Counter

n = int(input())
s = input()
mod = 10 ** 9 + 7
cnt = 1
for i in Counter(list(s)).values():
    cnt *= (i + 1)
print((cnt - 1) % mod)

Solution (Python):
from collections import Counter

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

c = Counter(s)
ans = 1

for i in range(ord("a"), ord("z")+1):
    ans *= (c[chr(i)] + 1)

print((ans - 1)%mod)

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

ans=1
for i,m in c.items():
    ans*=(m+1)
    ans%=mod
print(ans-1)

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

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

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

MOD = 1000000007

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

result = 1
for x in d.values():
    result *= x + 1
    result %= MOD
result += MOD - 1
result %= MOD

print(result)

Solution (Python):
from collections import Counter

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

cnter = Counter(S)
alpha = set(cnter)

ans = 1

for i in alpha:
    ans *= (cnter[i] + 1)

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

Solution (Python):
from collections import Counter

N = int(input())
cnt_list = Counter(input())
mod = 10**9+7
total = 1

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

Solution (Python):
def main():
    length = int(input())
    word = input()
    count = {}
    for i in range(length):
        if word[i] in count:
            count[word[i]] += 1
        else:
            count[word[i]] = 2
    mod = 10 ** 9 + 7
    answer = 1
    for c in count.values():
        answer = (answer * c) % mod
    print(answer - 1)


if __name__ == '__main__':
    main()

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):
import collections
MOD=10**9+7
N=int(input())
S=list(input())
c = collections.Counter(S)

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

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

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

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

n = int(input())
s = input()
a = ord('a')

counter = {chr(a + i): 0 for i in range(26)}

for c in s:
  counter[c] += 1
  
result = 1
for v in counter.values():
  result = result * (v + 1) % mod
print(result - 1)

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

from collections import Counter
c = Counter()

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



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

ans -= 1
print(ans)

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

from collections import Counter
c = Counter()

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



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

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

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

from collections import Counter
freq = Counter(S)

div = int(1e9 + 7)
total = 1
for c in freq.keys():
  
  total = total * (freq[c] + 1) % div

ans = total - 1
print(ans)

Solution (Python):

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

import collections
n_frq_dict = collections.defaultdict(int)
for s in S:
    n_frq_dict[s] += 1

mod=10**9+7
ret = 1
for frq in n_frq_dict.values():
    ret *= frq + 1
    ret %= mod
    
print(ret - 1)

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

def main():
    N = int(input())
    S = input()
    num_chars = 0
    A = {}
    for s in S:
        if s not in A:
            A[s] = 0
            num_chars += 1
        A[s] += 1
    
    B = [(a, A[a]) for a in A]

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

if __name__ == '__main__':
    main()

Solution (Python):

n = int(input())
s = list(input())
t = []
ans = 1
count= []

t = set(s)
t = list(t)

for i in range(len(t)):
    count.append(s.count(t[i]))

for j in range(len(count)):
    ans *= (count[j] + 1)

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

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

acc_char = [0 for i in range(26)]
ans = 0
for i in range(n):
    
    char = s[i]
    plus = 1
    for j in range(len(acc_char)):
        if (ord(char) - ord('a')) != j:
            plus *= acc_char[j] + 1
    ans += plus
    ans %= mod
    acc_char[ord(char) - ord('a')] += 1
print(ans%mod)

Solution (Python):




import string

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

cnt = [0 for i in range(26)]

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

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

Solution (Python):
a=int(input())
b=input()
b=list(b)
c=[0]*26
ans=0
t=0
for i in range(a):
	c[ord(b[i])-97]=c[ord(b[i])-97]+1

for j in range(26):
	t=c[j]
	for k in range(j+1,26):
		t=t*(c[k]+1)
	ans=ans+t
print(ans%(10**9+7))

Solution (Python):
from collections import Counter

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

n = Counter(S)
ans = 1
for i, j in n.items():
  ans *= (j+1)
print((ans-1)%mod)

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

Solution (Python):
from string import ascii_lowercase
from collections import defaultdict


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


c = defaultdict(int)
for i in range(N):
    c[S[i]] += 1

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

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

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

Solution (Python):
n=int(input())
s=input()
s_set=set(list(s))
t=len(s_set)
cnt=1

for s1 in s_set:
	cnt*=(1+s.count(s1))
	
print((cnt-1)%(10**9+7))

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

A = [0]*26
for e in S:
    A[ord(e)-97] += 1

ans = 1
for e in A:
    ans *= e+1
    ans %= MOD
print((ans-1)%MOD)

Solution (Python):

n=int(input())
a=list(input())
from collections import defaultdict
d=defaultdict(int)
for i in a:
    d[i]+=1
cnt=[]
for i in d.values():
    cnt.append(i+1)
ans=1
mod=10**9+7
for i in cnt:
    ans*=i
    ans%=mod
print(ans-1)

Solution (Python):
from collections import Counter

N = int(input())
S = input()
count = Counter(S)
mod = 10**9+7
ans = 1
for k, v in count.items():
    ans = ans * (v+1) % mod
print(ans-1)

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


if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
S=input()
MOD=10**9+7
ALP='qazwsxcedrfvtgbyhnujmikolp'
cnt={}
for s in ALP:
  cnt[s]=0
for s in S:
  cnt[s]+=1
ans=1
for s in ALP:
  ans*=cnt[s]+1
ans-=1
print(ans%MOD)

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

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

ans = x - 1
print(ans%MOD)

Solution (Python):
def solve():
    n = int(input())
    s = input()
    ans = 1
    mod = 1000000007
    for i in range(26):
        c = chr(ord('a') + i)
        a = s.count(c)
        a = (a + 1) % mod
        ans = (ans * a) % mod

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


if __name__ == "__main__":
    solve()

Solution (Python):
import sys
from collections import Counter
def main():
    input = sys.stdin.readline
    N = int(input())
    S = input().rstrip()

    C = Counter(S)
    ans = Mint(1)
    for a in C.values():
        ans *= a+1
    print(ans - 1)

class Mint:
    def __init__(self, value=0, mod=10**9+7):
        self.value = ((value % mod) + mod) % mod
        self.mod = mod

    @staticmethod
    def get_value(x): return x.value if isinstance(x, Mint) else x

    def inverse(self):
        a, b = self.value, self.mod
        u, v = 1, 0
        while b:
            t = a // b
            b, a = a - t * b, b
            v, u = u - t * v, v
        return (u + self.mod) % self.mod

    def __repr__(self): return str(self.value)
    def __eq__(self, other): return self.value == other.val
    def __neg__(self): return Mint(-self.value, self.mod)
    def __hash__(self): return hash(self.value)
    def __bool__(self): return self.value != 0

    def __iadd__(self, other):
        self.value = (self.value + Mint.get_value(other)) % self.mod
        return self
    def __add__(self, other):
        new_obj = Mint(self.value, self.mod)
        new_obj += other
        return new_obj
    __radd__ = __add__

    def __isub__(self, other):
        self.value = (self.value - Mint.get_value(other) + self.mod) % self.mod
        return self
    def __sub__(self, other):
        new_obj = Mint(self.value, self.mod)
        new_obj -= other
        return new_obj
    def __rsub__(self, other):
        new_obj = Mint(Mint.get_value(other), self.mod)
        new_obj -= self
        return new_obj

    def __imul__(self, other):
        self.value = self.value * Mint.get_value(other) % self.mod
        return self
    def __mul__(self, other):
        new_obj = Mint(self.value, self.mod)
        new_obj *= other
        return new_obj
    __rmul__ = __mul__

    def __ifloordiv__(self, other):
        other = other if isinstance(other, Mint) else Mint(other, self.mod)
        self *= other.inverse
        return self
    def __floordiv__(self, other):
        new_obj = Mint(self.value, self.mod)
        new_obj //= other
        return new_obj
    def __rfloordiv__(self, other):
        new_obj = Mint(Mint.get_value(other), self.mod)
        new_obj //= self
        return new_obj

if __name__ == '__main__':
    main()

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

MOD = 10**9 + 7

from collections import Counter

Scnt = Counter(list(S))

ans = 1
for cnt in Scnt.values():
    ans = (ans * (cnt + 1)) % MOD

ans -= 1

print(ans % MOD)

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
s = input()
c = Counter(s)
res = 1
for key in list(c):
    res *= c[key]+1
    res %= mod
print(res-1)

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
s = input()
c = Counter(s)
res = 1
for key in list(c):
    res *= c[key]+1
    res %= mod
print((res-1)%mod)

Solution (Python):
def main():
    MOD = 10**9 + 7
    n = int(input())
    s = input().rstrip()
    alp = [1]*26
    ans = 0
    for c in s:
        p = ord(c) - ord("a")
        alp[p] += 1
        x = 1
        for i in range(26):
            if i == p:
                continue
            x *= alp[i]
            x %= MOD
        ans += x
        ans %= MOD
    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):


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

ans=0
log=[1]*26
for item in S:
    item=ord(item)-97
    log[item]+=1

ans=1
for item in log:
    ans*=max(item,1)

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

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

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

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

Solution (Python):
from collections import Counter

n = int(input())
s = input()
c = Counter(list(s))
total = 1
for v in c.values():
  total = (total * (v + 1)) % 1000000007
print(total - 1)

Solution (Python):
from collections import Counter

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

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

Solution (Python):
n=int(input())
s=input()
t=sorted(s)
t.append("X")
cnt=1
ans=1
for i in range(n):
    if t[i]==t[i+1]:
        cnt+=1
    else:
        ans*=(cnt+1)
        cnt=1
print((ans-1)%(10**9+7))

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

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

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

s = sorted(s)
s += '
count = 1
ans = 1
for i in range(1, n+1):
    if s[i] == s[i-1]:
        count += 1
    else:
        ans = (ans * (count+1)) % mod
        count = 1
print(ans-1)

Solution (Python):
MOD=10**9+7
class Fp(int):
    def __new__(self,x=0):return super().__new__(self,x%MOD)
    def inv(self):return self.__class__(super().__pow__(MOD-2,MOD))
    def __add__(self,value):return self.__class__(super().__add__(value))
    def __sub__(self,value):return self.__class__(super().__sub__(value))
    def __mul__(self,value):return self.__class__(super().__mul__(value))
    def __floordiv__(self,value):return self.__class__(self*self.__class__(value).inv())
    def __pow__(self,value):return self.__class__(super().__pow__(value%(MOD-1), MOD))
    __radd__=__add__
    __rmul__=__mul__
    def __rsub__(self,value):return self.__class__(-super().__sub__(value))
    def __rfloordiv__(self,value):return self.__class__(self.inv()*value)
    def __iadd__(self,value):self=self+value;return self
    def __isub__(self,value):self=self-value;return self
    def __imul__(self,value):self=self*value;return self
    def __ifloordiv__(self,value):self=self //value;return self
    def __ipow__(self,value):self=self**value;return self
    def __neg__(self):return self.__class__(super().__neg__())

from collections import Counter
def main():
    N=int(input())
    S=input()
    C=Counter(S)
    ans=Fp(1)
    for v in C.values():
        ans*=v+1
    print(ans-1)

if __name__ == "__main__":
    main()

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

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

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

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

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

mod = 10**9+7

scnt = Counter(s).most_common()
ans = 1

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

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

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

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

MOD = 10**9 + 7

from collections import Counter

ctr = Counter(s)

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

Solution (Python):
from itertools import groupby as gb
n,s=open(0)
n=int(n)
s=sorted(s[:-1])

ans=1
mod=10**9+7
for i,x in gb(s):
  ans=ans*(len(list(x))+1)%mod
print(ans-1)

Solution (Python):
from itertools import groupby as gb
n=int(input())
s=sorted(input())
ans=1
mod=10**9+7
for i,x in gb(s):
  ans=ans*(len(list(x))+1)%mod
print(ans-1)

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

C = collections.Counter(S)
ans = 1

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

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

Solution (Python):
def main():
    from collections import Counter

    MOD = 10 ** 9 + 7

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

    ctr = Counter(S)

    ret = 1
    for count in ctr.values():
        ret = (ret * (count + 1)) % MOD
    print(ret - 1)


if __name__ == '__main__':
    main()

Solution (Python):

from collections import defaultdict as dd
n=int(input())
s=input()
mod=10**9+7
ans=1
c=dd(int)

for ss in s:
    c[ord(ss)-97]+=1

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

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

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

t = [0 for i in range(26)]

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

ans = 1
for i in range(26):
    if t[i] == 0:
        continue
    if t[i] == 1:
        ans *= 2
    elif t[i] > 1:
        ans *= t[i] + 1

print((ans-1) % MOD)

Solution (Python):
from sys import stdin
import string
from itertools import groupby

n = int(stdin.readline().rstrip())
s = list(stdin.readline().rstrip())
s.sort()
lin = []
for key, value in groupby(s):
    lin.append(len(list(value)))
point = 1
for i in lin:
    point *= i+1
    point %= 10**9+7
print(point-1)

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

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

from collections import defaultdict
dic = defaultdict(int)

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

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

print(ans -1)

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

Solution (Python):
N = int(input())
S = input()
MOD = 10**9+7
d = {}
for i in range(N):
  if S[i] in d:
    d[S[i]].append(i)
  else:
    d[S[i]] = [i]
ans = 1
for k,v in d.items():
  ans *= len(v)+1
  ans %= MOD
print((ans-1)%MOD)

Solution (Python):
p = 10**9+7
N = int(input())
S = input().strip()
C = {chr(i):[] for i in range(97,123)}
for i in range(N):
    C[S[i]].append(i)
cnt = 1
for j in range(97,123):
    cnt = (cnt*(1+len(C[chr(j)])))%p
print((cnt-1)%p)

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

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

ans = 1
for i in range(26):
	if car[i] == 0:
		continue
	else:
		ans *= (car[i]+1)
		ans %= mod

print(ans - 1)

Solution (Python):
mod = 10**9 + 7
N = int(input())
S = list(input())
al = [chr(ord("a") + i ) for i in range(26)]
cntAl = [ S.count(chr(ord("a") + i )) for i in range(26)]
ans = 1
for a in cntAl:
    if a != 0:ans *= (a+1)%mod
print((ans-1)%mod)

Solution (Python):
mod = 10**9 + 7
N = int(input())
S = list(input())
al = [chr(ord("a") + i ) for i in range(26)]
cntAl = [ S.count(chr(ord("a") + i )) for i in range(26)]
ans = 1
for a in cntAl:
    if a != 0:ans *= (a+1)%mod
print((ans-1)%mod)

Solution (Python):
import collections
N=int(input())
S=[i[1] for i in collections.Counter(list(input())).most_common()]
mod=10**9+7
count=0
ruiseki=0
for i in S:
    count+=i + count * i
    count%=mod
print(count)

Solution (Python):
import math
import bisect
import collections
import itertools
import heapq
import string
import sys
sys.setrecursionlimit(10**9)
def gcd(a,b):return math.gcd 
def lcm(a,b):return (a*b) // math.gcd(a,b) 
def iin(): return int(input()) 
def isn(): return input().split() 
def imn(): return map(int, input().split()) 
def iln(): return list(map(int, input().split())) 
def iln_s(): return sorted(iln()) 
def iln_r(): return sorted(iln(), reverse=True) 
def join(l, s=''): return s.join(l) 
def perm(l, n): return itertools.permutations(l, n) 
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) 
def comb(l, n): return itertools.combinations(l, n) 
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) 
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i: divisors.append(n//i)
    return divisors
def is_prime(n):
    if n == 1: return False
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0: return False 
    return True
def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n + 1, i): is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
def sieve_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

N = iin()
c = collections.Counter(input())
mod = 10**9+7
ans = 1
for v in c.values():
    ans *= (v+1)
    ans %= mod
print((ans-1)%mod)

Solution (Python):
import collections

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

d = collections.Counter(S)
ans = 1
for key in d:
  ans = ans * (d[key] + 1)
print((ans-1) % (10**9 +7))

Solution (Python):
import collections

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

c = collections.Counter(S)

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

ans -= 1

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

Solution (Python):






from functools import reduce

n = int(input())
s = input()
d = {}
for sv in s:
    if sv not in d:
        d[sv] = 1
    else:
        d[sv] += 1
ans = reduce(lambda x, y: x * y, list(map(lambda x: x[1] + 1, d.items()))) - 1
print(ans % (10**9+7))

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
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 I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()


l=['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']


lc=[0]*26

def main():
  n=I()
  s=S()

  ans=1

  for x in s:
    lc[l.index(x)]+=1

  for x in lc:
    ans*=(x+1)
    ans%=mod

  return ans-1


print(main())

Solution (Python):
n=int(input())
s=input()
d=dict()
ans=1
for i in range(n):
  if s[i] not in d:
    d[s[i]]=1
  else:
    d[s[i]]+=1
ld=list(d.values())
for i in range(len(ld)):
  if ld[i]==1:
    ans*=2
  else:
    ans*=ld[i]+1
print((ans-1)%(10**9+7))

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

def main():
	N = int(input())
	S = input().rstrip()
	M = 10**9 + 7
	
	
	
	
	
	
	
	A = ord("a")
	res = 1
	for i in range(26):
		q = chr(i+A)
		qc = S.count(q)
		res = res * (qc+1) % M
		
	print((res-1) % M)
	
main()

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10


def solve():
    n = II()
    s = S()
    d = defaultdict(int)
    for i in s:
        d[i] += 1
    ans = 1
    for di in d.values():
        ans *= di + 1
        ans %= mod
    print((ans - 1) % mod)
    return



if __name__ == '__main__':
    solve()

Solution (Python):
from collections import defaultdict

iCnt = int(input())
S = input()
M = 10**9 + 7

vCntDct = defaultdict(int)

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

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

print(ans - 1)

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

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

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

Solution (Python):

from collections import Counter
n = int(input())
s = input()
c = Counter(s)
ans = 1
for v in c.values():
    ans *= (v+1)
    ans %= int(1e+9+7)
    
print (ans-1)

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

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