3025: Colorful Ribbon

时间限制:1000 ms 内存限制:128 MB
上传者:
提交:3 通过:1

题目描述

Lizishu has a colorful ribbon, which can be expressed as a string consists of only lowercase letters, and each letter represents a color.

Now she wants to divide the ribbon into several parts so that no color appears more than one time in each part.

Tell her how many different ways can she divide the ribbon, output the answer modulo $10^9 + 7$.

输入格式

The first line contains an integer number T, the number of test cases.

i-th of each next T lines contains a string $s$ consists of lowercase letters ($1 \leq |s| \leq 10^5$).

输出格式

For each test case print the answer modulo $10^9 + 7$.

输入样例 复制

2
a
abcba

输出样例 复制

1
12