{"problem":{"name":"Just K","description":{"content":"You are given $N$ strings $S_1,S_2,\\dots,S_N$ consisting of lowercase English alphabets. Consider choosing some number of strings from $S_1,S_2,\\dots,S_N$. Find the maximum number of distinct alphabet","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc249_c"},"statements":[{"statement_type":"Markdown","content":"You are given $N$ strings $S_1,S_2,\\dots,S_N$ consisting of lowercase English alphabets.\nConsider choosing some number of strings from $S_1,S_2,\\dots,S_N$.\nFind the maximum number of distinct alphabets that satisfy the following condition: \"the alphabet is contained in exactly $K$ of the chosen strings.\"\n\n## Constraints\n\n*   $1 \\le N \\le 15$\n*   $1 \\le K \\le N$\n*   $N$ and $K$ are integers.\n*   $S_i$ is a non-empty string consisting of lowercase English alphabets.\n*   For each integer $i$ such that $1 \\le i \\le N$, $S_i$ does not contain two or more same alphabets.\n*   If $i \\neq j$, then $S_i \\neq S_j$.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $K$\n$S_1$\n$S_2$\n$\\vdots$\n$S_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc249_c","tags":[],"sample_group":[["4 2\nabi\naef\nbc\nacg","3\n\nWhen $S_1,S_3$, and $S_4$ are chosen, `a`,`b`, and `c` occur in exactly two of the strings.\nThere is no way to choose strings so that $4$ or more alphabets occur in exactly $2$ of the strings, so the answer is $3$."],["2 2\na\nb","0\n\nYou cannot choose the same string more than once."],["5 2\nabpqxyz\naz\npq\nbc\ncy","7"]],"created_at":"2026-03-03 11:01:13"}}