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

Solution in Python (3.4.3) (judge verdict: Accepted)

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

result=1
for i in count:
	result=result*i

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