Pinocchio
InterviewTime limit2sMemory limit512 MB
Count the ordered 4-tuples of distinct positions in S whose letters are A, C, G, T in some fixed assignment.
- Level
Easy3 of 10
- Topics
- Combinatorics, Math
- Solved
- No attempts yet
Problem
A human chromosome is made of four bases, written with the four letters A, C, G, and T. Junseo decided to build a Pinocchio that will serve his shifts for him.
Junseo has a base sequence of length . Pulling one A, one C, one G, and one T out of that sequence and synthesizing them builds one Pinocchio. Two bases with the same letter behave a little differently depending on where they sit in the sequence. Two Pinocchios are therefore the same only when all four positions they came from are the same, and they differ as soon as one position differs. Find how many kinds of Pinocchio Junseo can build.
Input
The first line contains the length of the base sequence, (). The second line contains a string of length . Every character of is one of A, C, G, and T.
Output
Print, on one line, the number of kinds of Pinocchio modulo .