{"raw_statement":[{"iden":"statement","content":"Talented Mr. Tang has $n$ strings consisting of only lowercase letters. He wants to charge them with Balala Power (he could change each letter ranged from '_a_' to '_z_' into any number ranged from $0$ to $25$, but every two different letters must not be changed into the same number) so that he could casually calculate the sum of these strings as integers in the base of $26$.\n\nMr. Tang wants you to maximize the sum. Note that no string in this problem can have any leading zeros when regarded as integers, except for the string \"_0_\". Therefore, he guarantees that at least one type of letter would not appear at the beginning of any given string.\n\nThe sum may be quite large, so you should output it modulo $(10^9 + 7)$ instead.\n\nThe input contains multiple (about $20$) test cases.\n\nFor each test case, the first line contains an integer $n$ ($1 <= n <= 10^5$), indicating the number of strings.\n\nThe $i$-th of the next $n$ lines contains a string $s_i$ ($1 <= | s_i | <= 10^5$) consisting of only lowercase letters. It is guaranteed that $sum_{i = 1}^n | s_i | <= 10^6$ for each test case.\n\nFor each test case, output \"_Case #x: y_\" in one line (without quotes), where $x$ indicates the case number starting from $1$, and $y$ denotes the answer to the corresponding case.\n\n"},{"iden":"input","content":"The input contains multiple (about $20$) test cases.For each test case, the first line contains an integer $n$ ($1 <= n <= 10^5$), indicating the number of strings.The $i$-th of the next $n$ lines contains a string $s_i$ ($1 <= | s_i | <= 10^5$) consisting of only lowercase letters. It is guaranteed that $sum_{i = 1}^n | s_i | <= 10^6$ for each test case."},{"iden":"output","content":"For each test case, output \"_Case #x: y_\" in one line (without quotes), where $x$ indicates the case number starting from $1$, and $y$ denotes the answer to the corresponding case."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ a, b \\in \\Sigma^* $ be two strings over the lowercase English alphabet, representing reserved areas on each riverside, with $ |a|, |b| \\leq 10^3 $.  \nEach character $ a_i \\in a $ and $ b_j \\in b $ denotes the squad assigned to the $ i $-th and $ j $-th area on the left and right riverside, respectively.\n\n**Constraints**  \nBridges may only connect areas assigned to the same squad.  \nNo two bridges may cross: if bridge $ (i, j) $ connects $ a_i $ to $ b_j $ and bridge $ (i', j') $ connects $ a_{i'} $ to $ b_{j'} $, then $ i < i' \\iff j < j' $.\n\n**Objective**  \nFind the maximum number of non-crossing bridges such that each bridge connects $ a_i $ to $ b_j $ with $ a_i = b_j $.  \nThis is equivalent to computing the **Longest Common Subsequence (LCS)** of strings $ a $ and $ b $.","simple_statement":"Given two strings a and b, each representing reserved areas on opposite riverbanks. Each character represents a squad. A bridge can be built between two areas with the same squad letter. Bridges cannot cross. Find the maximum number of non-crossing bridges possible.","has_page_source":false}