시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 150 MB411133.333%

문제

There are 26 students in Elly's English class. Since this number is exactly the same as the number of letters in the English alphabet, the kids play the following game. In increasing order of their number (in Bulgaria each student in a class has a unique number) each of them says one letter from his/her name. For example, ELLY can say one of the letters 'E', 'L', or 'Y'; KRISS can say 'K', 'R', 'I', or 'S'; and STAN can say 'S', 'T', 'A', or 'N'. Please note that if there are repeating letters in someone's name (which is the case for ELLY and KRISS) it doesn't matter which one they choose – the letter the other kids hear is the same.

Their teacher wants each of the letters in the alphabet to be said exactly once, thus getting a permutation of the letters of the alphabet. Now Elly wonders how many different permutations they can form.

입력

On the standard input, will be given 26 strings Si containing only uppercase letters of the English alphabet – the name of each of the children in the order they are in the class. Each name is no more than five characters long. It is possible that some of the people have the same name.

출력

On a single line of the standard output print one integer – the number of different permutations of the English alphabet that can be formed if we take one character from the first string, followed by one character from the second string and so on. It is guaranteed that for every input the answer is less than 1018.

서브태스크

번호배점제한
120

1 ≤ |Si| ≤ 3

230

1 ≤ |Si| ≤ 4

350

1 ≤ |Si| ≤ 5

예제 입력 1

ELLY KRISS STAN WU ALEX ZOE POOH KATE VILI MAXIM QT G ZAEK BOBI TEO YOYO DEQN FIL CECO DAWG JORO MONI SASHO DUDA VESKO POOH

예제 출력 1

1592

예제 입력 2

ESPR SHUM ENNN BULG ARIA YOU HAVE TO SOLVE HARD TASKS WHO WILL WIN THIS TIME CDFMQ CEFHJ GIOTV JOSUW CRVWX KMSYZ HQRUZ DGWXY BMRTU MUXYZ

예제 출력 2

48627

힌트

Explanation of the first sample test

Some of the possible permutations in the first sample are "ERAULOHKIXQGZBTYNFCWJMSDVP", "LRNWXEHAVITGZBOYQFCDJMSUKP" and "YRTWXZPKLMQGABEONFCDJISUVH".

채점 및 기타 정보

  • 예제는 채점하지 않는다.