Problem Statement
输入n个字符串,现在需要给它们从0到n - 1标号,
满足m条形如 标号为a[i]的字符串是标号为b[i]的字符串的前缀 的限制。
求标号方案数,模10^9+7输出。
n,字符串长度 <= 50, m <= 8。
Fox Ciel has a list of names on her computer. In this problem, a name is simply a non-empty string of lowercase letters. All names in her list are distinct.
One day, when she left her seat, she forgot to lock her computer.
Then, Lun the mischievous dog appeared, and randomly shuffled the order of the names in her list.
Now, Ciel has to restore the original order of names using her memory. You are given a String[] names, along with two int[]s info1 and info2. names contains all names in the shuffled list in the order they appear.
info1 and info2 describes Ciel's memory of the original list. She remembers that, for each valid i, the info1[i]-th (0-indexed) name in the original list was a prefix of the info2[i]-th name.
Let X be the number of possible orders of the names in the original list that are consistent
with Ciel's memory. Calculate and return the value (X modulo 1,000,000,007). X can be 0, which means
Ciel's memory is inconsistent with the names in the list.