아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Alpha

시간 제한2초메모리 제한150 MB

요약
26개의 이름이 순서대로 주어질 때, i번째 자리에 i번째 이름에 나오는 글자가 오도록 알파벳 순열을 만드는 경우의 수를 센다.
난이도

보통10점 중 7점

유형
동적 계획법, 비트 연산
정답자
아직 제출이 없습니다

문제

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.

힌트

Explanation of the first sample test

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

예제2

  1. 예제 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
    
    예상 출력
    1592
    
  2. 예제 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
    
    예상 출력
    48627