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 string import ascii_lowercase
from collections import defaultdict


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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans=0
log=[0]*26
for item in S:
    item=ord(item)-97
    log[item]+=1
    temp=2**(26-log.count(0))
    sub=0
    for index,num in enumerate(log):
        if index!=item:
            sub+=(temp//2//2)*max((num-1),0)
    ans+=temp//2+sub
    ans%=10**9+7
print(ans)

Submission status: Wrong Answer

Solution code:
def extgcd(a,b): 
    r = [1,0,a] 
    w = [0,1,b] 
    while w[2]!=1: 
        q = r[2]//w[2] 
        r2 = w 
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]] 
        r = r2 
        w = w2 
        #[x,y] 
        return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m        

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

ans=0
log=[0]*26
mod=10**9+7
for item in S:
    item=ord(item)-97
    if log[item]==0:
        log[item]+=1
        ans+=ans+1
    else:
        ans+=ans//2+1
    
print(ans%mod)

Submission status: Wrong Answer

Solution code:
def extgcd(a,b): 
    r = [1,0,a] 
    w = [0,1,b] 
    while w[2]!=1: 
        q = r[2]//w[2] 
        r2 = w 
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]] 
        r = r2 
        w = w2 
        #[x,y] 
        return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m        

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

ans=0
log=[0]*26
mod=10**9+7
for item in S:
    item=ord(item)-97
    if log[item]==0:
        log[item]+=1
        ans+=ans+1
    else:
        ans+=ans//2+1
        
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

from collections import Counter

ctr = Counter(s)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,s=int(input()),str(input())
ans=0
for i in range(n-1):
  for j in range(i,n):
    x=s[i:j+1]
    if all(x.count(c)==1 for c in x):
      ans+=1
print(ans%(10**9+7))

Submission status: Wrong Answer

Solution code:
from collections import Counter
N=int(input())
S=input()
d=Counter(S)
ans = 1
for s in d.keys():
    ans *= (d[s]+1)
    #print(ans)
print(ans-1)

Submission status: Wrong Answer

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

from collections import defaultdict
d=defaultdict(int)
ans = 0
for i,s in enumerate(S):
    ans += 2 **(i-d[s])
    d[s] += 1
    #print(ans)
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
A = int(input())
V = list(input())
v = len(list(set(V)))
a = 0
if A - v == 0:
  a = 1
else:
  a = A-v
q = (((2**v)-1) * a)
print(q)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections
N=int(input())
S=[i[1] for i in collections.Counter(list(input())).most_common()]

count=0
ruiseki=0
for i in S:
    count+=i + count * i
print(count)

Submission status: Wrong Answer

Solution code:
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()) #整数map取得
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())
ans = 1
for v in c.values():
    ans *= (v+1)
print(ans-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# 最終的な倒叙回数だけで決まりそうな気がした(登場回数+1を掛けて最後に空文字ぶん1を引く)
# なんでかというと、同じ文字は含まないので、結局登場する順番は関係ないから。ある文字が複数あったとき、ひとつだけ選ぶ（あるいは選ばない）というのは、「どの時点で登場した文字を採用するか」と同義。
# などとドヤったけど6WAくらいだしましたしにます
# と思ったらMODしてなかった件


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)

Submission status: Wrong Answer

Solution code:
# 最終的な倒叙回数だけで決まりそうな気がした(登場回数+1を掛けて最後に空文字ぶん1を引く)
# なんでかというと、同じ文字は含まないので、結局登場する順番は関係ないから。ある文字が複数あったとき、ひとつだけ選ぶ（あるいは選ばない）というのは、「どの時点で登場した文字を採用するか」と同義。
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)

Submission status: Wrong Answer

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

# a〜z -- START --
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']
# a〜z --- END ---

lc=[0 for _ in range(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)

  return ans-1

# main()
print(main())

Submission status: Wrong Answer

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

# a〜z -- START --
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']
# a〜z --- END ---

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)

  return ans-1

# main()
print(main())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
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

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


#main
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
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

#solve
def solve():
    n = II()
    s = S()
    d = [0] * 26
    for i in range(n):
        d[ord(s[i]) - ord("a")] += 1
    ans = 1
    for di in d:
        ans *= (di + 1)
    print(ans - 1)
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

from collections import Counter
c = Counter(S)
ans = 1
for v in c.values(): ans *= v+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 x in c.values():
  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 x in c.values():
  ans *= x
print(ans-1)

Submission status: Wrong Answer

Solution code:
from collections import Counter

n = int(input())
l = list(input())
l = list(Counter(l).values())

ans = 1

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
import numpy as np

mod = 10**9 + 7
n = int(input())
l = list(input())
l = list(Counter(l).values())

ans = 1

for i in l:
    ans *= (i+1) % mod

print(ans - 1)

Submission status: Wrong Answer

Solution code:
from collections import Counter

mod = 10**9 + 7
n = int(input())
l = list(input())
l = list(Counter(l).values())

ans = 1

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

print(ans - 1)

Submission status: Wrong Answer

Solution code:
from collections import Counter
import numpy as np

n = int(input())
l = list(input())
l = list(Counter(l).values())

print((np.prod([i+1 for i in l])-1)%(10**9 + 7))

Submission status: Wrong Answer

Solution code:
from collections import Counter
import numpy as np

n = int(input())
l = list(input())
l = list(Counter(l).values())

print(np.prod([i+1 for i in l])-1)

Submission status: Wrong Answer

Solution code:
import itertools
from collections import Counter
import numpy as np

n = int(input())
l = list(input())
l = list(Counter(l).values())

ans = n

for i in range(2, len(l)+1):
    conbis = list(itertools.combinations(l, i))
    for conbi in conbis:
        ans += np.prod(conbi)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
total = (2**N-1)%(10**9+7)
dicta = {}
for i in range(N):
    if S[i] not in dicta:
        dicta[S[i]] = 1
    else:
        dicta[S[i]] += 1
dup = [v for v in dicta.values()]
dc = 1
for i in dup:
    dc *= i+1
print(dc -1)

Submission status: Wrong Answer

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

alphabet='abcdefghijklmnopqrstuvwxyz'
nums=[1]*26
for i in range(N):
  ind=alphabet.index(S[i])
  nums[ind]+=1
out=1
for i in nums:
  out*=i
print(out-1)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int
from collections import Counter
from itertools import product
def solve(N: int, S: str):
    counter = dict(Counter(S))
    values = list(counter.values())
    LEN = len(values)
    answer = 0   
    p = list(product([0, 1], repeat=LEN))

    for pp in p:
        a = 1
        for i in range(LEN):
            if pp[i] == 1:
                a *= values[i]
        answer += a
    print(answer-1)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# 異なる一から取り出された部分列は区別して数えるから、特定の文字の場所による関係は考慮しなくてよい
from collections import Counter
N = int(input())
S = input()

# 同じ文字を使うことはできないので、"b"を使える回数は1回までで、どのbを使うかだけを考慮する
count = Counter(S)
ans = 1
for k, v in count.items():
    ans *= (v+1)
print(ans-1)

Submission status: Wrong Answer

Solution code:
from collections import Counter
MOD = 10**9
def solve(n, s):
    D = Counter(s)
    res = 1
    for num in Counter(s).values():
        res = (res * (num+1)) % MOD
    return res - 1

n = int(input())
s = input()
print(solve(n, s))

Submission status: Wrong Answer

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

"""
a~zの全てのアルファベットが1回以下使われる組み合わせ(複数ある場合は区別される)
を求めれば良い。
なお、部分列であるので、連続である必要はない。
Ex.
aが文字列に２つ含まれる場合。
どちらか片方を使う　で2通り
どちらも使わない　　で1通り
　　　　　　　　　　計3通りある。
なお、全ての組み合わせを求めた後、それには「全てを使わない」選択肢が含まれているので
全ての組み合わせ-1が答えとなる。
"""

import collections

c = collections.Counter(s)

c_value_lst = list(c.values())

ans = 1

for i in c_value_lst:
    ans *= (i+1)

print(ans-1)

Submission status: Wrong Answer

Solution code:
def examA():
    N = I(); S = SI()
    d = defaultdict(int)
    ans = 1
    for s in S:
        d[s] +=1
    for i in d.values():
        ans *=(i+1)
    print(ans-1)

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examA()

Submission status: Wrong Answer

Solution code:
num = int(input())
words = input()

words_count = {}
for key in words:
    if key in words_count:
        words_count[key] += 1
    else:
        words_count[key] = 1

ans = 1
for key, val in words_count.items():
    ans *= (val + 1)

print(ans - 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
import collections

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N = ri()
S = list(rs())
MOD = 10 ** 9 + 7
answer = 1
c = collections.Counter(S)
for k, v in c.items():
    answer *= v + 1

print(answer-1)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N=int(input())
S=list(input())
flag=[0]*26

ans=[0]
for index, cha in enumerate(S):
    i=ord(cha)-97
    if flag[i]==1:
        ans.append(ans[-1]+ans[-1]//2+1)
    else:
        ans.append(ans[-1]*2+1)
        flag[i]=1
    #print(ans)
        
print(ans[-1])

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
S = list(input())
MOD = 10**9 + 7
C = Counter(S)
#print(C)
ans = 1
for c in C:
  ans *= (C[c] + 1) % MOD
ans -= 1
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
S = list(input())
MOD = 10**9 + 7
C = Counter(S)
#print(C)
ans = 1
for c in C:
  ans *= C[c] + 1
ans -= 1
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    s = str(readline().rstrip().decode('utf-8'))
    s = collections.Counter(s)
    t = 1
    for k, v in s.items():
        t *= (v + 1)
    print(t - 1)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import collections
import itertools
import sys
n = int(input())
s = list(input())
count = collections.Counter(s).most_common()
c1 = [c[1] for c in count if c[1]>1]
l = len(count)-len(c1)
if n==l:
  print(2**n-1)
  sys.exit()
ans = 0
for p in itertools.product([0,1],repeat=len(c1)):
  tmp =1
  for i,x in enumerate(p):
    tmp = tmp*c1[i]**x*2**l
  ans += tmp
print((ans-1)%(10**9+7))

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
s = input().rstrip()
MOD = 10**9 + 7

counter = collections.Counter(s)
res = 1
for v in counter.values():
    res *= v + 1
res -= 1
print(res)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

d = defaultdict(int)
for key in S:
    d[key] += 1

ans = 1
for i in d.items():
    ans *= (i[1] + 1)

print(ans - 1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

cnt = 1
for v in s.values():
    cnt *= (v + 1)
print(cnt - 1)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

cnt = 1
for v in s.values():
    if v == 1:
        cnt *= 2
    else:
        cnt *= (v + 1)
print(cnt - 1)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
l = {}
for c in s:
    if c in l:
        l[c] += 1
    else:
        l[c] = 1
ans = 1
for i in l.values():
    ans *= i+1
print(ans-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
mod = 1e9 + 7
cnt = [1]*27
for c in S:
   cnt[ord(c) - ord('a')]+=1
ans = 1
for c in cnt:
   ans *= c
   ans %= mod
print(ans-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
mod = 1e9 + 7
cnt = [1]*27
for c in S:
   cnt[ord(c) - ord('a')]+=1
ans = 1
for c in cnt:
   ans *= c
print(ans-1)

Submission status: Wrong Answer

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

L = []
for i in range(len(S)):
  if len(L) == 0:
    L.append([S[i], 2])
  else:
    u = 0
    for j in range(len(L)):
      if S[i] == L[j][0]:
        L[j][1] += 1
        u += 1
    if u == 0:
      L.append([S[i], 2])
p = 1    
for l in range(len(L)):
  p *= L[l][1]
print(p - 1)

Submission status: Wrong Answer

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

L = []
for i in range(len(S)):
  if len(L) == 0:
    L.append([S[i], 2])
  else:
    u = 0
    for j in range(len(L)):
      if S[i] == L[j][0]:
        L[j][1] += 1
        u += 1
    if u == 0:
      L.append([S[i], 2])
p = 1    
for l in range(len(L)):
  p *= L[l][1]
  p %= 10e9 + 7
print(int((p-1) % (10e9 + 7)))

Submission status: Wrong Answer

Solution code:
n=int(input())

s=input()

s=s+s

counter=1

lists=[]

for i in range(n):

  if s[i]==s[i+1]:

    counter+=1

  else:

    lists.append(counter)

    counter=1

ans=1

for i in lists:

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

print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import collections

N = int(input().split()[0])
S = input()
counter = collections.Counter(S)
count = 1
for _, v in counter.items():
    # その文字数の数 + 1ケース（選ばないケース)
    count = count * (v + 1)

# 空文字列も含まれるので1引く
ans = count - 1
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import collections

N = int(input().split()[0])
S = input()
counter = collections.Counter(S)
count = 1
for _, v in counter.items():
    count *= v + 1

# 空文字列も含まれるので1引く
ans = count - 1
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter


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

    c = Counter(s)

    ans = 1
    for k, v in c.items():
        ans *= v + 1

    ans -= 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
S=input()
a=0
l=[0]*26
for i in S:
    t=1
    for j in range(26):
        if j!=ord(i)-97:
            t*=(l[j]+1)%(10**9+7)
    a+=t%(10**9+7)
    l[ord(i)-97]+=1
print(a)

Submission status: Wrong Answer

Solution code:
from collections import Counter

n = int(input())
s = list(input())
c = Counter(s)
m = 10**9 + 7

ans = 1
for i in c:
    ans *= (c[i] + 1) % m
ans -= 1

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

n = int(input())
s = list(input())
c = Counter(s)
m = 10**9 + 7

if n == 1:
    print(0)
    exit()
if n == 2:
    print(2)
    exit()

ans = 1
for i in c:
    ans *= (c[i] + 1) % m
ans -= 1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
n=int(input())
s=str(input())
a=Counter(s)
aa=list(a.values())
aa.sort()
aa=aa[::-1]
m=len(aa)
ans=0
#print(aa)
for i in range(1,2**m):
    z=format(i,'b').zfill(m)
    #print(z)
    ans1=1
    for j in range(m):
        if int(z[j])>0:
            ans1*=aa[j]*int(z[j])%(10**9+7)
    ans+=ans1%(10**9+7)
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s = input()
c = Counter(s)
ans = 1
for i in c:
  ans *= c[i]+1
print(ans-1)

Submission status: Wrong Answer

Solution code:
lis = [1 for i in range(26)]
n = int(input())
s = str(input())
for i in range(len(s)):
  lis[ord(s[i])-ord("a")] += 1
ans = 1
for num in lis:
  ans *= num
print(ans-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
listS = list(S)
setS = set(listS)
#異なる文字から2個を選ぶ場合（2項定理の利用）
res = 2**len(setS)-1
for x in setS:
    n = listS.count(x)
    if n > 1 and len(setS)-1 > 0:
        res += (2**(len(setS)-1))*(n-1)
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
listS = list(S)
setS = set(listS)
#異なる文字から2個を選ぶ場合（2項定理の利用）
res = 2**len(setS)-1
for x in setS:
    n = listS.count(x)
    if n > 1:
        res += (2**(len(setS)-1))*(n-1)
print(res)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
mod=10**9+7
t=dict()
for c in s:
    t.setdefault(c,1)
    t[c]+=1
ans=1
for v in t.values():
    ans*=v%mod
print(ans-1)

Submission status: Wrong Answer

Solution code:
from collections import Counter


def resolve():
    n = int(input())
    s = input()
    c = Counter(s)
    ans = 1
    mod = 10 ** 9 + 7
    for v in c.values():
        ans *= v + 1
    print(ans - 1 % mod)


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
from collections import Counter


def resolve():
    n = int(input())
    s = input()
    c = Counter(s)
    ans = 1
    for v in c.values():
        ans *= v + 1
    print(ans - 1)


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

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


def resolve():
    n = int(input())
    s = input()
    c = Counter(s)
    a = reduce(mul, [v + 1 for v in c.values()]) - 1
    print(a)


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

n = int(input())
d = defaultdict(int)

for s in input():
    d[s] += 1

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

print(ans - 1)

Submission status: Wrong Answer

Solution code:

dic = {}

N = int(input())

S = input()

for i in range(N):

    if S[i] not in dic:
        dic[S[i]] = 1

    else:
        dic[S[i]] += 1
        
ans = 1

for i in dic:

    ans *= dic[i] + 1

print (ans-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
ch = {}
for c in s:
  if c in ch:
    ch[c] += 1
  else:
    ch[c] = 1

ans = 1

for c in ch:
  if ch[c] != 0:
    ans *= 1 + ch[c]
  else:
    continue
  if ans >= 1000000007:
    ans -= 1000000007

ans += 1000000007
ans -= 1
if ans >= 1000000007:
  ans -= 1000000007
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
ch = {}
for c in s:
  if c in ch:
    ch[c] += 1
  else:
    ch[c] = 1

ans = 1

for c in ch:
  if ch[c] != 0:
    ans *= 1 + ch[c]
  else:
    continue
  if ans >= 1000000007:
    ans -= 1000000007

ans -= 1
print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
input()
c=Counter(input())
a=1
for i in c.items():
    a*=(1+i[1])
    a/=10**9+7
print(a-1)

Submission status: Wrong Answer

Solution code:
from collections import Counter
input()
c=Counter(input())
a=1
for i in c.items():
    a*=(1+i[1])
print(a-1)

Submission status: Wrong Answer

Solution code:
import collections as c

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

S=list(c.Counter(S).items())
print(S)

ans=1
for s in S:
  ans*=(s[1]+1)
print((ans-1)%(10**9+7))

Submission status: Wrong Answer

Solution code:
import collections as c

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

S=list(c.Counter(S).items())
#print(S)

ans=1
for s in S:
  ans*=(s[1]+1)
print(ans-1)