{"problem":{"name":"B. Balala Power!","description":{"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","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":2000,"memory_limit":131072},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10225B"},"statements":[{"statement_type":"Markdown","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## Input\n\nThe 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.\n\n## Output\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[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**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 $.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10225B","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}