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:

from collections import defaultdict
import itertools
import functools
import operator

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 = 0
    for i in range(1, len(count_list) + 1):
        now_data = list(itertools.combinations(count_list, i))
        for ele in now_data:
            result = functools.reduce(operator.mul, ele)
            ans += result

    print(ans)





if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

c = Counter(s)

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

print(ans - 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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
print(cnt_list)
for i in range(len(cnt_list)):
    ans=ans*(cnt_list[i]+1)%(10**9+7)
print(ans-1)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=list(input())
s.sort()
cnt=1
cnt_list=[]
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
    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*=(cnt_list[i]+1)%(10**9+7)
print(ans-1)

Submission status: Wrong Answer

Solution code:
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
for i in s:
    ans*=(i+1)
print(ans-1)

Submission status: Wrong Answer

Solution code:
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 = 0
    # for i, v in enumerate(values):
    for v in values:
            # temp = v
            # for v in values[i+1:]:
            #     temp = (temp * (1 + v)) % MOD
            # count = (count + temp) % MOD
        count *= (1 + v)
        count %= MOD

    return (count-1) % MOD


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

Submission status: Wrong Answer

Solution code:
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 = 0
    # for i, v in enumerate(values):
    for v in values:
            # temp = v
            # for v in values[i+1:]:
            #     temp = (temp * (1 + v)) % MOD
            # count = (count + temp) % MOD
        count *= (1 + v)
        count %= MOD

    return count


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

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
l = list(set(S))
ans = 1
for v in l:
  ans *= S.count(v) + 1
print(ans-1)

Submission status: Wrong Answer

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

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)

Submission status: Wrong Answer

Solution code:
num=int(input())
string=input()
string=list(string)
alpha=[0]*26
res=1
for s in string:
  alpha[ord(s)-97]+=1
for k in alpha:
  res*=(k+1)
print(res-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(input())
box = []

for hoge in range(n):
    if not [s[hoge],s.count(s[hoge])] in box:
        box.append([s[hoge], s.count(s[hoge])])
ans = 1

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
l=input()
ans=0
for i in range(n):
  m=set()
  for j in l[i:]:
    if j not in m:
      ans+=1
      m.add(j)
    else:
      break
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N = int(input())
S = input()

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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def ecount(X):
  c,ans=1,[]
  for i in range(len(X)-1):
    if X[i]==X[i+1]:c+=1
    else:
      ans.append(c);c=1
  ans.append(c)
  return ans
n,s=int(input()),input();c=[s[i]for i in range(n)];c.sort()
a=ecount(c);a.sort();ans=1
for i in a:ans*=i+1
print(ans-1)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
ans=0
for i in range(n):
    for j in range(i,n):
        if s[j] in s[i:j]:
            break
        ans+=1
print(ans)

Submission status: Wrong Answer

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

chars = [1] * 27

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

res = 1
for c in chars:
    res *= c
res -= 1

print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[e for e in input()]
l.sort()
m=[1]
for i in range(1,n):
    if l[i]==l[i-1]:
        m[-1]+=1
    else:
        m.append(1)
ans=1
for i in range(len(m)):
    ans*=m[i]+1
print(ans-1)

Submission status: Wrong Answer

Solution code:
n=int(input())
A=input()
B=set(A)
ans=1
for i in B:
  ans*=(A.count(i)+1)
print(ans-1)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
def rec(l, i, s):
    global ans
    if i < len(l)-1:
        rec(l, i+1, s*l[i])
        rec(l, i+1, s)
    else:
        ans += s * (l[i] + 1)


N = int(input())
s = input()
c = Counter(s)
cum = list(dict(c).values())
ans = 0
rec(cum, 0, 1)
print(ans-1)

Submission status: Wrong Answer

Solution code:


N=int(input())
s=input()

#count
c_list=[]
c_index={}
c_count=[]
for i in s:
	if(i not in c_list):
		c_list.append(i)
		c_index[i]=len(c_list)-1
		c_count.append(1)
	else:
		c_count[c_index[i]]+=1

		
a=1
for i in range(len(c_list)):
	a*=c_count[i]+1	



print(a-1)

Submission status: Wrong Answer

Solution code:
S = "abcab"
S = "aabc"
m = 1

for i in set(S):
    m *= S.count(i)+1
#     print(m, S.count(i))
print( (m-1) % (10**9+7) )

Submission status: Wrong Answer

Solution code:
import collections

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

dic = collections.Counter(S)
ans = 1
for k,v in dic.items():
    ans *= (int(v)+1)

print(ans - 1)

Submission status: Wrong Answer

Solution code:

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = input()
s = input()
m=1
for i in set(s):
    m *= s.count(i)+1
print(m-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

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

unique_list = list(np.unique(S))

ans = 1

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

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

print(ans - 1)

Submission status: Wrong Answer

Solution code:
N = input()
S = {}
for i in [chr(i) for i in range(97, 97+26)]:
    S[i] = 1
for i in input():
    S[i] += 1
result = 1
for i in S.values():
        result *= i
print(result-1 % (10**9+7))

Submission status: Wrong Answer

Solution code:
N = input()
S = {}
for i in [chr(i) for i in range(97, 97+26)]:
    S[i] = 1
for i in input():
    S[i] += 1
result = 1
for i in S.values():
        result *= i
print(result-1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import math

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

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

ans = 1
for s in strDict:
    ans *= strDict[s] + 1

ans -= 1
print(ans)

Submission status: Wrong Answer

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

alp = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
count = [1]*26

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

ans = 1
for a in range(26):
    ans *= count[a]

ans -= 1

print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=input()
mod = 10**9+7
dp=[0 for x in range(N)]
dp[0]=2
for i in range(1,N):
    if S[i] in S[:i]:
        dp[i]=dp[i-1]+dp[i-1]//2
        dp[i] %= mod
    else:
        dp[i]=dp[i-1]*2
        dp[i] %= mod

print(dp[N-1]-1)

Submission status: Wrong Answer

Solution code:
M= 10**9+7
ans = 1

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

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

print(ans-1)

Submission status: Wrong Answer

Solution code:

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

MOD = 10**9 + 7

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

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

    #print(counts)
    total = 1
    for k in counts:
        total *= (k+1)
        total % MOD
    print(total-1)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:

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

MOD = 10**9 + 7

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

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

    #print(counts)
    total = 1
    for k in counts:
        total *= (k+1)
        total % MOD
    print(total-1)

main()

Submission status: Wrong Answer

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

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

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

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

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
lis = list(S)
k = 1
se = set(lis)
for item in se:
  l = lis.count(item)
  k = k*(l + 1)
print(k)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def counter(flag,st):
  count = 0
  if st == '':
    return count
  for i in range(len(st)):
    if not st[i] in flag:
      flag[st[i]] = 1
      count += 1
      count += counter(flag,st[i:])
      del flag[st[i]]
  return count

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


cnt = 0
for i in range(N):
  flag = {}
  cnt += counter(flag,S[i:])
print(cnt)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
# ----------------------------------------------------------------
# Use Solve Function

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


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

#
# solve !!
#
solve(lines)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

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

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

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

ret = 1
for num in alpha_list:
    ret *= (num + 1)
print((ret-1)/100000000+7)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

count = 1

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

print(count-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import exit
MOD = 10**9 + 7
L = int(input())
# a = [int(input()) for _ in range(N)]
S = str(input())
dic = {}
for s in S:
    if not s in dic:
        dic[s] = 1
    else:
        dic[s]+=1
ans =1
for d in dic.keys():
    ans*=dic[d]+1
print(ans-1%MOD)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import exit
L = int(input())
# a = [int(input()) for _ in range(N)]
S = str(input())
dic = {}
for s in S:
    if not s in dic:
        dic[s] = 1
    else:
        dic[s]+=1
ans =1
for d in dic.keys():
    ans*=dic[d]+1
print(ans-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(input().strip())
ans=1
for i in set(S):
    ans=ans*(S.count(i)+1)
ans-=1
print(ans)

Submission status: Wrong Answer

Solution code:
import collections
N=int(input())
l=list(input())
c=collections.Counter(l)
m=1
for k, v in c.items():
    m*=(v+1)
m=m-1
print(m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import pprint

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

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

#print (N)
#print (S)

mydict = {}

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

pprint.pprint(mydict)

count_1 = 0
c = 1

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
num = int(input())
arr = [0] * 26
x = input()
words = list(x)
mod = 1e9+7

temp = 0
for i in range(num):
    temp = ord(words[i]) - 97
    arr[temp] += 1

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

print(tmp-1)

Submission status: Wrong Answer

Solution code:
num = int(input())
arr = [0] * 26
x = input()
words = list(x)
mod = 1e9+7

temp = 0
for i in range(num):
    temp = ord(words[i]) - 97
    arr[temp] += 1

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

print(tmp-1)

Submission status: Wrong Answer

Solution code:
num = int(input())
arr = [0] * 26
x = input()
words = list(x)
mod = 1e9+7

temp = 0
for i in range(num):
    temp = ord(words[i]) - 97
    arr[temp] += 1

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

print(tmp-1)

Submission status: Wrong Answer

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


l=n+1
for i in range(n):
  a=set()
  for j,k in enumerate(s[i:]):
    a.add(k)
    if len(a)!=j+1:
      break
    l+=1
print(l%1000000007)

Submission status: Wrong Answer

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


l=n+1
for i in range(n):
  a=set()
  for j,k in enumerate(s[i:]):
    print(k)
    a.add(k)
    if len(a)!=j+1:
      break
    l+=1
print(l%1000000007)

Submission status: Wrong Answer

Solution code:
num = int(input())
arr = [0] * 26
x = input()
words = list(x)

temp = 0
for i in range(num):
    temp = ord(words[i]) - 97
    arr[temp] += 1

tmp  = 1
for i in range(26):
    tmp *= (arr[i] + 1)

print(tmp-1)

Submission status: Wrong Answer

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


l=n+1
for i in range(n):
  a=set()
  for j,k in enumerate(s[i:]):
    a.add(k)
    if len(a)!=j+1:
      break
    l+=1
print(l)

Submission status: Wrong Answer

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


l=n
for i in range(n):
  a=set()
  for j,k in enumerate(s[i:]):
    a.add(k)
    if len(a)!=j+1:
      break
    l+=1
print(l)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
s = list(input())

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

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
s = list(input())

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

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

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

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
s = list(input())

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

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

print(np.prod(count)-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
S = input()
S = collections.Counter(S)
s_count = []
for i in S.values():
    s_count.append(i)
ans = 1
while s_count:
    ans *= s_count.pop() + 1
print(ans - 1)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

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

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

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

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

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

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

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

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

print(ans-1)

Submission status: Wrong Answer

Solution code:
#coding: utf-8
N = int(input())
S = input()
mod = 1e9 + 7
alpha = list(map(chr,range(97,123)))
ans = 1
for i in alpha:
    ans *= S.count(i) + 1
print(int((ans-1) % mod))

Submission status: Wrong Answer

Solution code:
#coding: utf-8
N = int(input())
S = input()
mod = 1e9 + 7
alpha = list(map(chr,range(97,123)))
ans = 1
for i in alpha:
    ans *= S.count(i) + 1
print((ans-1) % mod)

Submission status: Wrong Answer

Solution code:
#coding: utf-8
N = int(input())
S = input()
mod = 1e9 + 7
alpha = list(map(chr,range(97,123)))
ans = 1
for i in alpha:
    ans *= S.count(i) + 1
    print(S.count(i))
print((ans-1) % mod)

Submission status: Wrong Answer

Solution code:
import collections
N=int(input())
l=list(input())
c=collections.Counter(l)
m=1
for k, v in c.items():
    m*=(v+1)
m=m-1
m=m%(10^9+7)
print(m)

Submission status: Wrong Answer

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

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

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

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

ans -= 1

print(ans)

Submission status: Wrong Answer

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

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

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

ans = 1
for val in cd.values():
    ans *= val + 1

ans -= 1

print(ans)

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
l = list(input())
c = collections.Counter(l)
m = 1
for k, v in c.items():
    m *= (v + 1)
print(m - 1)

Submission status: Wrong Answer

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


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

print(reduce(mul, (m+1 for m in Counter(S).values()))-1)

Submission status: Wrong Answer

Solution code:
# N,M = map(int, input().split())
N = int(input())
S = input()

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

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

Submission status: Wrong Answer

Solution code:
"""AtCoder"""

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

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

ans = 1

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

print(ans - 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
"""AtCoder"""

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

l = "abcdefghijklnmopqrstuvwxyz"

ans = 1

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

print(ans - 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
import functools
import operator
input()
print(functools.reduce(operator.mul, [i + 1 for i in list(Counter(input()).values())]) - 1)

Submission status: Wrong Answer

Solution code:
ord_a=ord("a")
N=int(input())
S=input()
C=[0]*26
dp=[0]*(N+1)
dp[0]=1
mod=10**9+7
for i in range(N):
  dp[i+1]=(2*dp[i]-C[ord(S[i])-ord_a])%mod
  C[ord(S[i])-ord_a]=dp[i]
  
print(dp[N]-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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