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 sys import exit

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


def get_count():
    count = 2 ** N - 1

    considered = []
    use = []

    for s in S:
        if s not in considered:
            if S.count(s) != 1:
                use.append(s)
        considered.append(s)

    if not use:
        return count

    i = 0
    c = []
    d = 1
    e = 0
    for u in use:
        c.append(S.count(u))
        d *= (2 ** c[i] - c[i] - 1)
        e += c[i]
        count -= (2 ** c[i] - c[i] - 1) * 2 ** (N - c[i])
        i += 1

    if len(use) == 1:
        return count

    count += d * 2 ** (N - e)

    return count


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

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
x,ans = [1]*26,1
for i in s: x[ord(i)-97]+=1
for i in x: ans*=i
print(ans-1)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
import collections

def main():
	N = int(input())
	S = input()
	tmp = list(S)
	
	strings = collections.Counter(tmp)
	
	ans = 1
	for key in strings:
		ans = ans * (strings[key] + 1)
	
	print(ans-1)
			
if __name__ == "__main__":
	main()

Submission status: Wrong Answer

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

s_dict = {}
for s in S:
    if s in s_dict:
        s_dict[s] += 1
    else:
        s_dict[s] = 2

ans = 1
for val in s_dict.values():
    ans *= val
print(ans-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from string import ascii_lowercase
from functools import reduce
from operator import mul

# 入力
N = int(input())
S = input()

# 解は(各アルファベットの出現回数+1)の総積
ans = reduce(mul, map(lambda c: S.count(c) + 1, ascii_lowercase)) - 1

# 出力
print(ans)

Submission status: Wrong Answer

Solution code:
from string import ascii_lowercase
from functools import reduce
from operator import mul

# 入力
N = int(input())
S = input()

# 解は(各アルファベットの出現回数+1)の総積
ans = reduce(mul, map(lambda c: S.count(c) + 1, ascii_lowercase))

# 出力
print(ans)

Submission status: Wrong Answer

Solution code:
from string import ascii_lowercase
from functools import reduce
from operator import mul

# 入力
N = int(input())
S = input()

# 解は(各アルファベットの出現回数+1)の総積
ans = reduce(mul, map(lambda c: S.count(c), ascii_lowercase))

# 出力
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
ans = 1
for c in [chr(ord('a')+i) for i in range(26)]:
    ans *= S.count(c) + 1
print(int((ans-1) % (10e9 + 7)))

Submission status: Wrong Answer

Solution code:
def main():
    input()
    s=input()
    import collections
    c = collections.Counter(s)
    # print(c)
    ans = 1
    for n in c.values():
        ans *= (n+1)
    ans -= 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
a = list('abcdefghijklmnopqrstuvwxyz')
cnt = [0]*26
for i,a_ in enumerate(a):
    cnt[i] += s.count(a_)+1
ans = 1
for cnt_ in cnt:
    ans *= cnt_
print(int(ans%(1e9+7))-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
a = list('abcdefghijklmnopqrstuvwxyz')
cnt = [0]*26
for i,a_ in enumerate(a):
    cnt[i] += s.count(a_)+1
ans = 1
for cnt_ in cnt:
    ans *= cnt_
ans %= (1e9+7)
print(int(ans)-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
a = list('abcdefghijklmnopqrstuvwxyz')
cnt = [0]*26
for i,a_ in enumerate(a):
    cnt[i] += s.count(a_)+1
ans = 1
for cnt_ in cnt:
    ans *= cnt_
print(int((ans-1)%(1e9+7)))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
a = list('abcdefghijklmnopqrstuvwxyz')
cnt = [0]*26
for i,a_ in enumerate(a):
    cnt[i] += s.count(a_)+1
ans = 1
for cnt_ in cnt:
    ans *= cnt_
print((ans-1)%(1e9+7))

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

X = Counter(S)

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

print(ans-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
a = list('abcdefghijklmnopqrstuvwxyz')
cnt = [0]*26
for i,a_ in enumerate(a):
    cnt[i] += s.count(a_)+1
ans = 1
for cnt_ in cnt:
    ans *= cnt_
print(ans-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
a = list('abcdefghijklmnopqrstuvwxyz')
cnt = [0]*26
for i,a_ in enumerate(a):
    cnt[i] += s.count(a_)
ans = 1
for cnt_ in cnt:
    ans *= cnt_
print(ans-1)

Submission status: Wrong Answer

Solution code:
from collections import Counter
from sys import stdin

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

    cnt = Counter(S)
    ans = 1
    for i in cnt.values():
        ans *= i + 1
    print(ans - 1)

input = lambda: stdin.readline().rstrip()
main()

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
S = input()
S = [i for i in S]
S = Counter(S)
MOD = 10 * 9 + 7

res = 1
for i in S.values():
    res *= (i + 1)
res -= 1
print(res % MOD)

Submission status: Wrong Answer

Solution code:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


N = I()
s = S()

inf = 10**9+7

counts = collections.Counter(s)
result = 1
for i in counts.values():
    result *= i+1
result -= 1
print(result)
exit()

Submission status: Wrong Answer

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

MOD = 1000000007  # type: int


def solve(N: int, S: str):
    abc = "abcdefghijklmnopqrstuvwxyz"
    # ans = 2**N % MOD
    # n = N
    # pre = 1
    # for c in abc:
    #     count = S.count(c)
    #     kaburi = ((2 ** count)-1-count)
    #     ans -= pre * kaburi * (2 ** (n - count))
    #     pre *= (1 + count) % MOD
    #     n -= count
    #     ans = ans % MOD
    # print(int(ans-1))

    ans = 2**N % MOD
    print((np.prod([S.count(c) + 1 for c in abc])-1) % MOD)
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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:
import sys
# import bisect
# import math
# import itertools
# import numpy as np
# import collections

"""Template"""


class IP:
    """
    入力を取得するクラス
    """

    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        # 参考
        # https://blog.rossywhite.com/2018/08/06/bit-search/
        # https://atcoder.jp/contests/abc105/submissions/4088632
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    # output.append(a[j])
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        自然数だからn
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        oneで1
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x // y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)


"""ここからメインコード"""


def main():
    # 1文字に省略
    r, e = range, enumerate
    ip = IP()
    id = Idea()

    """この下から書いてね"""
    mod = 10 ** 9 + 7
    _ = ip.I()
    s = ip.S()
    ans = 1
    for i in set(s):
        ans *= s.count(i) + 1

    print((ans - 1) % mod)


main()

Submission status: Wrong Answer

Solution code:
import sys
# import bisect
# import math
# import itertools
# import numpy as np
# import collections

"""Template"""


class IP:
    """
    入力を取得するクラス
    """

    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        # 参考
        # https://blog.rossywhite.com/2018/08/06/bit-search/
        # https://atcoder.jp/contests/abc105/submissions/4088632
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    # output.append(a[j])
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        自然数だからn
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        oneで1
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x // y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)


"""ここからメインコード"""


def main():
    # 1文字に省略
    r, e = range, enumerate
    ip = IP()
    id = Idea()

    """この下から書いてね"""
    mod = 10 ** 9 + 7
    n = ip.I()
    s = ip.S()
    ans = 1
    for i in set(s):
        ans *= (s.count(i) + 1)
    
    print((ans - 1) % mod)


main()

Submission status: Wrong Answer

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

ans = 1
for c in [chr(x) for x in range(97, 97 + 26)]:
    ans *= S.count(c) + 1
print(ans - 1)

Submission status: Wrong Answer

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

no_dup_chr = 0
n_dup_ptn = 0
dup_chr = []
for c in S:
    if c in dup_chr:
        continue
    n_dup = S.count(c)
    if n_dup == 1:
        no_dup_chr += 1
    else:
        if n_dup_ptn == 0:
            n_dup_ptn = n_dup + 1
        else:
            n_dup_ptn *= n_dup + 1
        dup_chr.append(c)

# print("no_dup_chr: %d, dup_chr: %d" % (no_dup_chr, len(dup_chr)))

if n_dup_ptn > 0:
    print(pow(2, no_dup_chr) * n_dup_ptn - 1)
else:
    print(pow(2, no_dup_chr) - 1)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
check = {}
for i in "abcdefghijklmnopqrstuvwxyz":
    check[i] = 0
ans = 1
for i in range(n):
    check[s[i]] += 1
for i in "abcdefghijklmnopqrstuvwxyz":
    if check[i] == 0:continue
    ans *= check[i]+1
ans = (ans-1)%1000000009
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
check = {}
for i in "abcdefghijklmnopqrstuvwxyz":
    check[i] = 0
ans = 1
for i in range(n):
    ans += ans//(2**check[s[i]])
    check[s[i]] += 1
ans %= 1000000009
print(ans-1)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = input()
check = {}
for i in "abcdefghijklmnopqrstuvwxyz":
    check[i] = 0
ans = 1
for i in range(n):
    ans += ans//(2**check[s[i]])
    ans %= 1000000009
    check[s[i]] += 1
print(ans-1)

Submission status: Wrong Answer

Solution code:
from collections import Counter
from functools import reduce

N = int(input())
S = input()
counts = Counter(S).values()
print(reduce(lambda c, x: c+c*x, counts, 1)-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:
input()
s=input()
a=1
for t in map(s.count,set(s)):a*=-~t
print(a%(1e9+7)-1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math
import itertools


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# これだと、O(n*n)
"""
temp_ans = []


def problem_a(input_string):
    S = int(input_string[0].rstrip())
    N = input_string[1].rstrip()
    N_l = len(N)
    global temp_ans
    for i in range(N_l)[::-1]:
        temp_ans += N[i]
        #print(temp_ans)
        for s in temp_ans:
            #print(s)
            if N[i] not in s:
                temp_ans.append(N[i]+s)
    #print(temp_ans)
    return len(temp_ans) % (10**9 + 7)
"""


def problem_a(input_string):
    S = int(input_string[0].rstrip())
    N = input_string[1].rstrip()
    #print(S)
    dic = {}
    c = 0
    for i in range(S)[::-1]:
        if N[i] not in dic:
            dic[N[i]] = 1
            #c += i+1
        else:
            dic[N[i]] += 1
    c += 2**len(dic.keys())-1
    #print(c)
    #c += S
    for key, value in dic.items():
        if value > 1:
            #c -= (value-1)
            c += 2**(len(dic.keys()))-1
            #print(c)
    #for key, value in dic.items():
    for key, value in dic.items():
        if value > 1:
            if len(dic.keys()) != S:
                c -= 2**(S-len(dic.keys())-1)
            #print(c)
        #else:
    #c += (S-len(dic.keys()))
    """
    s_N = sorted(N)
    for i in range(S-1):
        if s_N[i] != s_N[i+1]:
            c += 2**(i+2)
    """
    """
    for key, value in dic.items():
        if value > 1:
            c += 2**(len(dic.items())-value)
        else:
            c += 2**(len(dic.items())-value)
    """
    #combinations_count(len(, r)

    return c % (10**9 + 7)


def main():
    input_line = stdin.readlines()
    answer = problem_a(input_line)
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from sys import stdin
import math
import itertools


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# これだと、O(n*n)
"""
temp_ans = []


def problem_a(input_string):
    S = int(input_string[0].rstrip())
    N = input_string[1].rstrip()
    N_l = len(N)
    global temp_ans
    for i in range(N_l)[::-1]:
        temp_ans += N[i]
        #print(temp_ans)
        for s in temp_ans:
            #print(s)
            if N[i] not in s:
                temp_ans.append(N[i]+s)
    #print(temp_ans)
    return len(temp_ans) % (10**9 + 7)
"""


def problem_a(input_string):
    S = int(input_string[0].rstrip())
    N = input_string[1].rstrip()
    #print(S)
    dic = {}
    c = 0
    for i in range(S)[::-1]:
        if N[i] not in dic:
            dic[N[i]] = 1
            #c += i+1
        else:
            dic[N[i]] += 1
    c += 2**len(dic.keys())-1
    #c += S
    for key, value in dic.items():
        if value > 1:
            #c -= (value-1)
            c += 2**(len(dic.keys()))-1
            c -= value
        #else:
    #c += (S-len(dic.keys()))
    """
    s_N = sorted(N)
    for i in range(S-1):
        if s_N[i] != s_N[i+1]:
            c += 2**(i+2)
    """
    """
    for key, value in dic.items():
        if value > 1:
            c += 2**(len(dic.items())-value)
        else:
            c += 2**(len(dic.items())-value)
    """
    #combinations_count(len(, r)

    return c % (10**9 + 7)


def main():
    input_line = stdin.readlines()
    answer = problem_a(input_line)
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(map(lambda x: ord(x),input()))
MOD = 10**9 + 7 # 1e9 + 7

# 各文字列について、出現回数+1(1つ取るか、一切とらない)
# それを全部かければ良い

AppearCount = [ 0 for _ in range(26)]

for n in range(N):
	AppearCount[S[n]-ord('a')] += 1

ans = 1
bFirst = True

for a in AppearCount:
	if a != 0:
		ans *= (a+1)
		if MOD < ans:
			ans -= MOD

ans -= 1

if MOD <= ans:
	ans -= MOD

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

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

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(map(lambda x: ord(x),input()))
MOD = 10e9 + 7


# 各文字列について、出現回数+1(1つ取るか、一切とらない)
# それを全部かければ良い

AppearCount = [ 0 for _ in range(26)]

for n in range(N):
	AppearCount[S[n]-ord('a')] += 1

ans = 1


for a in AppearCount:
	if a != 0:
		ans *= (a+1)

ans -= 1

if MOD <= ans:
	ans -= MOD

print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(map(lambda x: ord(x),input()))
MOD = 10e9 + 7


# 各文字列について、出現回数+1(1つ取るか、一切とらない)
# それを全部かければ良い

AppearCount = [ 0 for _ in range(26)]

for n in range(N):
	AppearCount[S[n]-ord('a')] += 1

ans = 1


for a in AppearCount:
	if a != 0:
		ans *= (a+1)
		if MOD <= ans:
			ans -= MOD

ans -= 1

if MOD <= ans:
	ans -= MOD

print(ans)

Submission status: Wrong Answer

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

ans = 2**N-1

tmp = []
cnt = 0
memo = []
for i in range(N):
  if(S.count(S[i]) != 1):
    cnt += 1
    if(S[i] not in memo):
      memo.append(S[i])
    else:
      continue
    if(len(S[i:]) != 1):
      tmp.append(len(S[i:]))
      cnt -= 1

for t in tmp:
  ans -= t*cnt
  cnt -= 1
print(ans%mod)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(map(lambda x: ord(x),input()))
MOD = 10e9 + 7


# 各文字列について、出現回数+1(1つ取るか、一切とらない)
# それを全部かければ良い

AppearCount = [ 0 for _ in range(26)]

for n in range(N):
	AppearCount[S[n]-ord('a')] += 1

ans = 1


for a in range(26):
	if AppearCount[a] != 0:
		ans *= (AppearCount[a]+1)
		if MOD <= ans:
			ans -= MOD

print(ans-1)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(map(lambda x: ord(x),input()))
MOD = 10e9 + 7


# 各文字列について、出現回数+1(1つ取るか、一切とらない)
# それを全部かければ良い

AppearCount = [ 0 for _ in range(26)]

for n in range(N):
	AppearCount[S[n]-ord('a')] += 1

ans = 1

for n in range(N):
	if AppearCount[S[n]-ord('a')] != 0:
		ans *= (AppearCount[S[n]-ord('a')]+1)
		if MOD <= ans:
			ans -= MOD

print(ans-1)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = input()
l = [1 for i in range(26)]

for s in S:
    l[ord(s) - ord('a')] += 1

ans = 1
for i in l:
    ans *= i

print(ans - 1)

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

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 LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n = II()
    s = SI()

    C = Counter(s)
    res = 1
    for c in C.values():
        res *= c + 1

    return res - 1


print(main())

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
cnt=[0]*26
for i in s:
    cnt[ord(i)-97]+=1
ans=1
for i in range(26):
    ans*=cnt[i]+1
print(ans-1)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=input()
cnt=[0]*26
for i in s:
    cnt[ord(i)-97]+=1
print(cnt)
ans=1
for i in range(26):
    ans*=cnt[i]+1
print(ans-1)

Submission status: Wrong Answer

Solution code:
# coding:utf-8

import sys
from collections import Counter, defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

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 LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n = II()
    s = SI()

    cnt = [0] * 27
    res = 0
    for c in s:
        k = ord(c) - 97
        cnt[k] += 1
        tmp = 1
        for i in range(27):
            if not cnt[i]:
                continue
            if i == k:
                continue
            tmp *= cnt[i] + 1
        res += tmp

    return res


print(main())

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

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

d = defaultdict(int)
for ss in s:
    d[ss] += 1

ans = 1
for k, v in d.items():
    ans *= (v + 1)
    # v通りの選び方 + 選ばない1通り
ans -= 1
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=input()
d={}
for c in S:
	d[c] = d[c]+1 if d.__contains__(c) else 1
mod=int(1e9+7)
ans=1
for a,b in d.items():
	ans*=(b+1)%mod

print(ans-1)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(input())
import collections
L=collections.Counter(S).values()
A=1
for i in L:
  A*=(i+1)
print(int((A-1)%(10e+7)))

Submission status: Wrong Answer

Solution code:
N=int(input())
S=input()
d={}
for c in S:
	d[c] = d[c]+1 if d.__contains__(c) else 1

ans=1
for a,b in d.items():
	ans*=(b+1)

print(ans-1)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(input())
import collections
L=collections.Counter(S).values()
A=1
print(L)
for i in L:
  A*=(i+1)
print(int((A-1)%(10e+7)))

Submission status: Wrong Answer

Solution code:
N=int(input())
S=input()
d={}
for c in S:
	d[c] = d[c]+1 if d.__contains__(c) else 1

ans=1
for a,b in d.items():
	ans*=(b+1)

print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(input())
import collections
L=collections.Counter(S).values()
A=1
for i in L:
  A*=(i+1)
print((A-1)%(10e9+7))

Submission status: Wrong Answer

Solution code:
import itertools
import functools
import operator


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

    str_list = list()
    for s in S:
        str_list.append(s)

    str_uni_list = {}
    for str in str_list:
        if (str in str_uni_list) is False:
            str_uni_list[str] = 1
        else:
            str_uni_list[str] += 1

    list_val = []
    for i in str_uni_list.values():
        list_val.append(i)

    ans = 0
    temp = 1
    for i in range(1, len(list_val) + 1):
        for j in list(itertools.combinations(list_val, i)):
            functools.reduce(operator.mul, j)
            ans += temp
            temp = 1

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
S=list(input())
import collections
L=collections.Counter(S).values()
A=1

for i in L:
  A*=(i+1)
print(A-1)

Submission status: Wrong Answer

Solution code:
import itertools as it
input()
s = input()
s_dic = {}
for c in s:
    if not c in s_dic.keys():s_dic[c] = 1
    else:s_dic[c] += 1
g = 0
for i in range(1,len(s_dic)+1):
    a = it.combinations(s_dic.keys(), i)
    gt = 0
    for t in a:
        gi = 1
        for u in list(t):
            gi *= s_dic[u]
        gt += gi
    g += gt
print(g)

Submission status: Wrong Answer

Solution code:
import itertools


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

    str_list = list()
    for s in S:
        str_list.append(s)

    str_uni_list = {}
    for str in str_list:
        if (str in str_uni_list) is False:
            str_uni_list[str] = 1
        else:
            str_uni_list[str] += 1

    list_val = []
    for i in str_uni_list.values():
        list_val.append(i)

    ans = 0
    temp = 1
    for i in range(1, len(list_val) + 1):
        for j in list(itertools.combinations(list_val, i)):
            for k in j:
                temp *= k
            ans += temp
            temp = 1

    print(ans % 10 ** 9)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

S = input()
p = 10 ** 9 + 7
D = defaultdict(int)

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

ans = 1
for k, v in D.items():
    ans *= (v + 1)
    ans %= p

print(ans - 1)

Submission status: Wrong Answer

Solution code:
import itertools


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

    str_list = list()
    for s in S:
        str_list.append(s)

    str_uni_list = {}
    for str in str_list:
        if (str in str_uni_list) is False:
            str_uni_list[str] = 1
        else:
            str_uni_list[str] += 1

    list_val = []
    for i in str_uni_list.values():
        list_val.append(i)

    ans = 0
    temp = 1
    for i in range(1, len(list_val) + 1):
        for j in list(itertools.combinations(list_val, i)):
            for k in j:
                temp *= k
            ans += temp
            temp = 1

    print(ans)


if __name__ == '__main__':
    main()