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 as.

Sample Input 3

5
abcab

Sample Output 3

17



Sample input:
4
abcd


Sample output:
15

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
s = str(input())
b = 10 ** 9 + 7 
# print(n);
# print(s);

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

    letter = defaultdict(int)
    letter_count = defaultdict(int)
    count = 0
    for i in range(N):
        new_count = count + 1
        new_count -= letter[S[i]] #今まで追加文字が使われている組み合わせはNG
        count += new_count #%mod #なぜか途中でmodを取るとNGになるTODO
        count %= mod
        letter[S[i]] += new_count #追加文字が追加されたことによる組み合わせ増分を増やす
        #追加文字による、他のある文字が使われる組み合わせの増加は
        #今まである文字が使われていた組み合わせの数-ある数が使われていてかつ追加文字が含まれている組み合わせ
        for key in letter:
            if key != S[i]:
                letter[key] += letter[key]//(1 + letter_count[S[i]])
        letter_count[S[i]] += 1
    print(count%mod)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def combi(num):
    return 2**(num+1) -1

if __name__ == '__main__':
    mod = 10**9 +7
    N = int(input())
    S = str(input())
    
    letter = defaultdict(int)
    letter_count = defaultdict(int)
    count = 0
    for i in range(N):
        new_count = count + 1
        new_count -= letter[S[i]] #今まで追加文字が使われている組み合わせはNG
        count += new_count%mod
        letter[S[i]] += new_count #追加文字が追加されたことによる組み合わせ増分を増やす
        #追加文字による、他のある文字が使われる組み合わせの増加は
        #今まである文字が使われていた組み合わせの数-ある数が使われていてかつ追加文字が含まれている組み合わせ
        for key in letter:
            if key != S[i]:
                letter[key] += letter[key]//(1 + letter_count[S[i]])
        letter_count[S[i]] += 1
    print(count%mod)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

def combi(num):
    return 2**(num+1) -1

if __name__ == '__main__':
    N = int(input())
    S = str(input())
    
    letter = defaultdict(int)
    letter_count = defaultdict(int)
    count = 0
    for i in range(N):
        new_count = count + 1
        new_count -= letter[S[i]] #今まで追加文字が使われている組み合わせはNG
        count += new_count
        letter[S[i]] += new_count #追加文字が追加されたことによる組み合わせ増分を増やす
        #追加文字による、他のある文字が使われる組み合わせの増加は
        #今まである文字が使われていた組み合わせの数-ある数が使われていてかつ追加文字が含まれている組み合わせ
        for key in letter:
            if key != S[i]:
                letter[key] += letter[key]//(1 + letter_count[S[i]])
        letter_count[S[i]] += 1
    print(count)

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

Solution code:
modp = 1000000007
n = int(input())
s = input()
d = dict()
for c in s:d[c] = d.get(c,0)+1
g=1
for i in range(len(d)):g *= 2
g -= 1
for c in sorted(d.keys()):g+=((g+1)//2)*(d[c]-1)%modp
print(g)

Submission status: Wrong Answer

Solution code:
modp = 10000007
n = int(input())
s = input()
d = dict()
for c in s:d[c] = d.get(c,0)+1
g=1
for i in range(len(d)):g *= 2
g -= 1
for c in sorted(d.keys()):g+=((g+1)//2)*(d[c]-1)%modp
print(g)

Submission status: Wrong Answer

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


if __name__ == '__main__':
    slove()

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
abc = "abcdefghijklmnopqrstuvwxyz"
ans = 1
for i in abc:
    ans *= s.count(i)+1
print(ans-1)

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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

print(ans-1)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#AGC31 A

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

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

Submission status: Wrong Answer

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

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

print(cnt - 1)

Submission status: Wrong Answer

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

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

print(ans-1)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

words = Counter(s)

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

print(ans-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline

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

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
s = collections.Counter(input()).values()
t = 1
for i in s:
    t *= (i + 1)
print(t - 1)

Submission status: Wrong Answer

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

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

count_list = [0] * 27

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

#print(count_list)

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

#print(count_list_new)
ans_list = list(itertools.product(range(2), repeat=len(count_list_new)))
ans = 0

for i in range(len(ans_list)):
    tmp = 1
    for j in range(len(count_list_new)):
        if ans_list[i][j] == 1:
            tmp *= count_list_new[j]
    ans += tmp

ans -= 1
print(ans)

Submission status: Wrong Answer

Solution code:
# AGC031A - Colorful Subsequence
from collections import Counter
from functools import reduce


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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N = int(input())
S = input()
# N = 100000
# S = "AXCVBASDXB"*10000


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

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


def pick(nowindex, picked, patterns):
    if nowindex == char_num:
        if 1 in picked:
            # print((picked, patterns))
            return patterns
        else:
            return 0

    p1 = pick(nowindex + 1, picked + [0], patterns)
    p2 = pick(nowindex + 1, picked + [1], patterns*char_list[nowindex])
    patterns = p1 + p2
    return patterns


print(pick(0, [], 1))

Submission status: Wrong Answer

Solution code:
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 *= (c[k] + 1) % (10 ** 9 + 7)
d -= 1
print(d)

Submission status: Wrong Answer

Solution code:
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 *= (c[k] + 1)
d -= 1
print(d)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = int(input())
b = list(input())
c = {}
for i in range(a):
    if b[i] not in c:
        c[b[i]] = 1

Submission status: Wrong Answer

Solution code:
###template###
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")
sys.setrecursionlimit(10**7)
# 4近傍（右, 下, 左, 上）
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())
###template###

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)

print(ans - 1) #1つも取らない場合を引く

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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) % mod

print(cnt - 1)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

nums = Counter(S).most_common()

mod = 10 ** 9 + 7
cnt = 0
c = 0
for u, v in nums:
    if v >= 2:
        cnt += 2 ** (N-v) % mod
        c += 1

if c >= 2:
    r = 2 ** (c-1) % mod
else:
    r = 0

print((2 ** N - cnt + (c-1) * r - 1) % mod)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

nums = Counter(S).most_common()

mod = 10 ** 9 + 7
cnt = 0
c = 0
for u, v in nums:
    if v >= 2:
        cnt += 2 ** (N-v) % mod
        c += 1

if c >= 2:
    c = 2 ** (c-1) % mod
else:
    c = 0

print((2 ** N - cnt + c - 1) % mod)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
S = input()
Co = Counter(S).values()
ans = 1
pul = 0
for i in Co:
    #print(i)
    if i == 1:
        ans *= 2
    else:
        ans *= (i + 1)
print(ans-1)

Submission status: Wrong Answer

Solution code:
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 *= n+1

ans -= 1
ans = int(ans % (1E9+7))
print(ans)

Submission status: Wrong Answer

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

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

print(ans-1)

Submission status: Wrong Answer

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

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

print(ans-1)

Submission status: Wrong Answer

Solution code:
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
print(l)
for i in range(y):
    m=m*(l[i]+1)%mod
print((m-1)%mod if n>1 else 1)

Submission status: Wrong Answer

Solution code:
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)
n=1
for i in range(y):
    n=n*(l[i]+1)%mod
print((n-1)%mod)

Submission status: Wrong Answer

Solution code:
n=int(input())
ss=input()
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)
    else:
        l.append(count)
        count=1
        x=s[i]
        if i==n-1:
            l.append(count)
y=len(l)
n=1
for i in range(y):
    n=n*(l[i]+1)
print(n-1)

Submission status: Wrong Answer

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

l = []
cnt = []
for i in s:
    x = 0
    if i not in l:
        l.append(i)
        x = s.count(i)
        cnt.append(x)
#print(l,cnt)
ans = 1
if n == 1:
    print(ans)
else:
    for x in cnt:
        if x == 1:
            ans *= 2
        else:
            ans *= (x+1)
    print(ans-1)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

c = Counter(S)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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]
print(ans-1)

Submission status: Wrong Answer

Solution code:
from collections import Counter

n = int(input())
s = input()
counter = Counter(s)
duplicate = len([x for x in counter.values() if x != 1])
ans = 1

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

Submission status: Wrong Answer

Solution code:
from collections import Counter

n = int(input())
s = input()
counter = Counter(s)
duplicate = len([x for x in counter.values() if x != 1])
ans = 2 ** n - 1

for char, count in counter.items():
    if count != 1:
        ans -= 2 ** (n - count)
        ans += duplicate-1
print(ans)

Submission status: Wrong Answer

Solution code:
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
ans -= 1
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
a=sorted(set(s))
ans=1
for x in a:
    ans*=(s.count(x)+1)
print(ans-1)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
a=sorted(set(s))
ans=1
for x in a:
    ans*=s.count(x)+1
print(ans-1)

Submission status: Wrong Answer

Solution code:
from collections import Counter
input()
c = Counter(input())

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

answer = x - 1
print(answer)

Submission status: Wrong Answer

Solution code:
from collections import Counter
from operator import mul
from functools import reduce

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

char_num = Counter(list(S))
print(reduce(mul, [c+1 for c in char_num.values()]) - 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
k = 1
for i in range(97,97+26):
  k *= (s.count(chr(i))+1)
print(k-1)

Submission status: Wrong Answer

Solution code:
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**+7
for x in al:
    ans*=(d[x]+1)
    ans%=mod
print((ans-1)%mod)

Submission status: Wrong Answer

Solution code:
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
for x in al:
    ans*=(d[x]+1)
print(ans-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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 *= i[1] + 1

ans -= 1
print(ans)

Submission status: Wrong Answer

Solution code:
from functools import reduce
import operator

N = int(input())

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(input().split())
import collections
s = collections.Counter(s)
s = s.most_common()
ans = 1
for i in s:
  ans *= i[1]
  
print(ans-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections as cl


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

counter_dic = dict(cl.Counter(S_lst))

print(counter_dic)
print(counter_dic.values())

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
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
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N=int(input())
S=input()
INF=1e9+7
dict=defaultdict(int)
for i in S:
    dict[i]+=1
l=list(dict.values())
ans=0
for i in range(1,2**len(l)):
    i=bin(i)[2:].zfill(len(l))
    tmp=1
    for j in range(len(l)):
        if i[j]=="1":
            tmp*=l[j]
            tmp%=INF
    ans+=tmp
    ans%=INF
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

N=int(input())
S=input()
INF=1e9+7
dict=defaultdict(int)
for i in S:
    dict[i]+=1
l=list(dict.values())
ans=0
for i in range(1,2**len(l)):
    i=bin(i)[2:].zfill(len(l))
    tmp=1
    for j in range(len(l)):
        if i[j]=="1":
            tmp*=l[j]
    ans+=tmp
print(ans)

Submission status: Wrong Answer

Solution code:
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(m-1)

Submission status: Wrong Answer

Solution code:
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 *= x

print(m-1)

Submission status: Wrong Answer

Solution code:
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)%MOD
print(ans-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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
    
print(ans-1)

Submission status: Wrong Answer

Solution code:
def solve():
    N = int(input())
    S = input()

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

    print(ans)

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
alphabets = str(set(S))
ans = 1
for alphabet in alphabets:
    cnt = S.count(alphabet)
    ans *= (cnt+1)
ans -= 1
print(ans)

Submission status: Wrong Answer

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

alphabets = "abcdefghijklmnopqrstuvwxyz"
ans = 1
for alphabet in alphabets:
    cnt = S.count(alphabet)
    ans *= (cnt+1)
ans -= 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# input
n = int(input())
s = input()


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

print(prod - 1)

Submission status: Wrong Answer

Solution code:
from itertools import combinations

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


# s frequent list
def make_freq(s):
    freq_s = []
    uniq_s = set(s)
    for char in uniq_s:
        freq_s.append(s.count(char))

    freq_s.sort(reverse=True)
    return freq_s

freq_s = make_freq(s)


# tuple product calc
def product(t):
    if len(t) == 0:
        return 0
    prod = 1
    for i in t:
        prod *= i
    return prod


# clac product i conbination
print(sum(product(comb) for i in range(len(freq_s)) for comb in combinations(freq_s, i + 1)))

Submission status: Wrong Answer

Solution code:
from itertools import combinations

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


# s frequent list
def make_freq(s):
    freq_s = []
    uniq_s = set(s)
    for char in uniq_s:
        freq_s.append(s.count(char))

    # 0 padding
    freq_s.extend(0 for _ in range(n - len(uniq_s)))

    freq_s.sort(reverse=True)
    return freq_s

freq_s = make_freq(s)


# tuple product calc
def product(t):
    if len(t) == 0:
        return 0
    prod = 1
    for i in t:
        prod *= i
    return prod


# clac product i conbination
print(sum(product(comb) for i in range(n) for comb in combinations(freq_s, i)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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 %= (10**9 + 7)
print(ans)

Submission status: Wrong Answer

Solution code:
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 %= 10**9 + 7
print(ans)

Submission status: Wrong Answer

Solution code:
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 %= 10**9 + 7
print(ans-1)

Submission status: Wrong Answer

Solution code:
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)
print(ans-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = str(input())
count = 0
for i in range(n):
    if s[i] in s[:i]:
        count += 1
ans = 2**len(s) - (2**(len(s)-2)-(count-1))*count - 1
print(ans)

Submission status: Wrong Answer

Solution code:
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-=1
print(ans)

Submission status: Wrong Answer

Solution code:

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
    print(ans - 1)





if __name__ == '__main__':
    main()