Ana and Banana are playing a game. First Ana picks a word, which is defined to be a nonempty sequence of capital English letters. (The word does not need to be a valid English word.) Then Banana picks a nonnegative integer $k$ and challenges Ana to supply a word with exactly $k$ subsequences which are equal to Ana's word. Ana wins if she is able to supply such a word, otherwise she loses. For example, if Ana picks the word "TST", and Banana chooses $k=4$, then Ana can supply the word "TSTST" which has 4 subsequences which are equal to Ana's word. Which words can Ana pick so that she wins no matter what value of $k$ Banana chooses? (The subsequences of a string of length $n$ are the $2^n$ strings which are formed by deleting some of its characters, possibly all or none, while preserving the order of the remaining characters.) Proposed by Kevin Sun
Problem
Source: USA TSTST 2017 Problem 2, by Kevin Sun
Tags: combinatorics, TSTST 2017, otis, USA, USA TSTST, combinatorics solved, Sequence
29.06.2017 07:08
Call the first word Ana chooses $S=s_1s_2s_3\dots s_n$, and the second word she must supply $W=w_1w_2w_3\dots w_n$. Ana wins if and only if she chooses an $S$ with an $s_m$ such that $s_{m-1}\neq s_m\neq s_{m+1}$. (We define $s_m\neq s_i$ for nonexistent $s_i$). For the "if" part, Ana's winning construction is easy. Given any $k$, and any element $s_m$ such that $s_{m-1}\neq s_m\neq s_{m+1}$, Ana supplies the word $W=w_1w_2w_3\dots w_{n+k-1}$ where $w_i=s_i$ for $1\le i\le m-1$, $w_i=s_m$ for $m\le i\le m+k-1$, and $w_i=s_{i-k+1}$ for $m+k\le i\le n+k-1$. Then all terms $s_i$ with $i\neq m$ will have a fixed corresponding $w_i$ term, and $s_m$ will have exactly $k$ options for its corresponding $w_i$ term, meaning $W$ has exactly $k$ sub-sequences $S$. For example, if $$S=\overbrace{AA\dots AA}^{a \text{ As}} B \overbrace{CC\dots CC}^{c \text{ Cs}}$$then $$W=\overbrace{AA\dots AA}^{a \text{ As}} \overbrace{BB\dots BB}^{k \text{ Bs}} \overbrace{CC\dots CC}^{c \text{ Cs}}$$always wins.$\square$ For the "only if" part, suppose there does not exist a term $s_m$ such that $s_{m-1}\neq s_m\neq s_{m+1}$. We claim that Ana is guaranteed to lose if Banana sets $k=2$. Suppose that Ana finds $2$ sub-sequences $S_a$ and $S_b$ such that $$S_a=W_{a_1}W_{a_2}W_{a_3}\dots W_{a_n}$$$$S_b=W_{b_1}W_{b_2}W_{b_3}\dots W_{b_n}$$We claim that there must exist a third valid sub-sequence $S_c$ distinct from $S_a$ and $S_b$. Let $j$ be the smallest $i$ such that $a_i\neq b_i$, and WLOG let $a_j<b_j$. Case 1: $a_{j+1}=b_{j+1}$. If $s_j=s_{j+1}$, then there is the valid $$S_c=W_{a_1}\dots W_{a_j}W_{b_j}W_{b_{j+2}}\dots W_{b_n}$$and Ana loses. If $s_j=s_{j-1}$, then there is the valid $$S_c=W_{a_1}\dots W_{a_{j-2}}W_{a_j}W_{b_j}\dots W_{b_n}$$and Ana loses. By our original at least one of $s_j=s_{j+1}$ and $s_j=s_{j-1}$ is true, so in this case Ana loses either way as there must exist a third sub-sequence $S_c$ distinct from $S_a$ and $S_b$. Case 2: $a_{j+1}\neq b_{j+1}$. Then there is the valid $$S_c=W_{a_1}\dots W_{a_j}W_{b_{j+1}}\dots W_{b_n}$$and Ana loses as this sequence is distinct from $S_a$ and $S_b$. We have covered both cases and shown that $\ge 2$ sub-sequences $S$ implies $\ge 3$ sub-sequences $S$. Thus Ana can never find a word $W$ with exactly 2 sub-sequences $S$, and is then guaranteed to lose in the "only if" case. We have shown our winning condition is both necessary and sufficient, and we are done. $\blacksquare$
29.06.2017 07:11
Let's call the first word said by Ana the 'seed', the number $k$ the 'challenge', and the second word uttered by Ana to be the 'response'. Divide the seed into maximal contiguous blocks of the same letters; so $AABBBCAAA$ would become $\boxed{AA}\boxed{BBB}\boxed{C}\boxed{AAA}.$ We claim that Ana can win iff there's at least one block of length one in the seed. To prove that this works, note that if the seed is $\boxed{\text{Stuff}}\boxed{X}\boxed{\text{Stuff}}$, Ana can respond with $\boxed{\text{Stuff}}\underbrace{\boxed{X\cdots X}}_{k\;X\text{'s}}\boxed{\text{Stuff}}$. Now we'll prove that other words don't work. We'll use induction on the number of blocks. For the base case, suppose the seed is $\underbrace{\boxed{A\cdots A}}_{n>1\; A\text{'s}}$. Then if $k$ is $2$, the seed has to have more than $n$ $A$'s, but then the number of matching subsequences is at least $\tbinom{n+1}{n}=n+1>2$, which is bad. Now suppose it has $m$ blocks. Once again, let Banana utter $k=2$. Suppose the leading block in the seed is $x$ $A$'s. Any letter in the response occurring before the $x-$th $A$ is pointless, so let's ignore them. If there are exactly $x$ $A$'s in the response, then there's only one way of choosing the first block from the response, so there has to be exactly $2$ choices for the rest of the block, which is impossible by induction hypothesis. If there are more than $x$ $A's$ which are possible candidates for the first block, then there are at least $\tbinom{x+1}{x}=x+1>2$ choices for the first block already, which is again a bad thing. So Ana must lose in this case, and our proof is complete. $\blacksquare$
05.12.2017 19:26
I wonder if Anna can choose $AB$,then the sequence $ABB...BA$(k times $B$) will containing $k$ subsequence equal to $AB$ Am i wrong?
06.12.2017 12:40
@above that sounds right to me.
09.03.2018 04:05
I realized now I never posted my solution, so here we go... First we introduce some notation. Define a block of letters to be a maximal contiguous subsequence of consecutive letters. Throughout the solution, we fix the word $A$ that Ana picks, and introduce the following notation for its $m$ blocks: \[ A = A_1 A_2 \dots A_m = \underbrace{a_1 \dots a_1}_{x_1} \underbrace{a_2 \dots a_2}_{x_2} \dots \underbrace{a_m \dots a_m}_{x_m}. \]A rainbow will be a subsequence equal to Ana's initial word $A$ (meaning Ana seeks words with exactly $k$ traces). Finally, for brevity, let $A_i = \underbrace{a_i \dots a_i}_{x_i}$, so $A = A_1 \dots A_m$. We prove two claims that resolve the problem. Claim: If $x_i = 1$ for some $i$, then for any $k \ge 1$, the word \[ W = A_1 \dots A_{i-1} \underbrace{a_i \dots a_i}_{k} A_{i+1} \dots A_m \]obtained by repeating the $i$th letter $k$ times has exactly $k$ rainbows. Proof. Obviously there are at least $\binom{k}{k-1}=k$ rainbows, obtained by deleting $k-1$ choices of the letter $a_i$ in the repeated block. We show they are they only ones. Given a rainbow, consider the location of this singleton block in $W$. It cannot occur within the first $|A_1| + \dots + |A_{i-1}|$ letters, nor can it occur within the final $|A_{i+1}| + \dots + |A_m|$ letters. So it must appear in the $i$th block of $W$. That implies that all the other $a_i$'s in the $i$th block of $W$ must be deleted, as desired. (This last argument is actually nontrivial, and has some substance; many students failed to realize that the upper bound requires care.) $\blacksquare$ Claim: If $x_i \ge 2$ for all $i$, then no word $W$ has exactly two rainbows. Proof. We prove if there are two rainbows of $W$, then we can construct at least three rainbows. Let $W = w_1 \dots w_n$ and consider the two rainbows of $W$. Since they are not the same, there must be a block $A_p$ of the rainbow, of length $\ell \ge 2$, which do not occupy the same locations in $W$. Assume the first rainbow uses $w_{i_1}$, \dots, $w_{i_\ell}$ for this block and the second rainbow uses $w_{j_1}$, \dots, $w_{j_\ell}$ for this block. Then among the letters $w_q$ for $\min(i_1, j_1) \le q \le \max(i_\ell, j_\ell)$, there must be at least $\ell+1$ copies of the letter $a_p$. Moreover, given a choice of $\ell$ copies of the letter $a_p$ in this range, one can complete the subsequence to a rainbow. So the number of rainbows is at least $\binom{\ell+1}{\ell} \ge \ell+1$. Since $\ell \ge 2$, this proves $W$ has at least three rainbows. $\blacksquare$ In summary, Ana wins if and only if $x_i = 1$ for some $i$, since she can duplicate the isolated letter $k$ times; but if $x_i \ge 2$ for all $i$ then Banana only needs to supply $k = 2$.
03.04.2019 20:24
I claim that Ana wins if her word contains a letter which isn't the same as any of its neighbors. Supposing her word is $x_1x_2\ldots x_n$, and this letter is $x_i$, then if B says $k$, she can supply the word $x_1x_2\ldots x_{i-1}x_ix_i\ldots x_ix_{i+1}\ldots x_n$, where there are $k$ $x_i$s. On the other hand, if every letter is at least a double letter, then I claim that she can't produce a word which works for $k=2$. We can do this by induction on the amount of blocks of consecutive identical letters. If there is only one block (i.e. the word is $x_1x_1\ldots x_1$, with $n$ letters), then no letters matter besides those identical to $x_1$. If there is more than one substring congruent to the word, then there must be at least $\binom{n+1}{n}=n+1>2$, so $k=2$ is impossible. Now, suppose that my word is $x_1x_1\ldots x_1x_2x_2\ldots x_k$, where there are $n$ $x_1$s. Also, let Ana's second word be $W$. Note that we can effectively ignore all letters in $W$ before the $n$th $x_1$. If there exists two substrings of $W$ which use a different subset of letters to form their first $n$ letters, then we can clearly get more than 2 satisfactory subsequences, since the union of these $x_1$s has size at least $n+1$, and we get a contradiction as in the base case. Otherwise, we know that all good subsequences will use only the first $n$ $x_1$s as their first $n$ letters, and we reduce it to the previous case. Therefore, we are done by inductive hypothesis.
30.07.2019 07:02
Let $A$ be the first string Ana picks, and $B$ be the second string Ana picks. We claim Ana wins if and only if there exists a letter in $A$ which is different from all (either 1 or 2) of its neighbors. For the if direction, we will provide a string $B$ Ana can pick to win. Let $a$ be a letter in $A$ which is different from its neighbors. Let $A=s_1as_2$, where $s_1,s_2$ are possibly empty. Then, we claim Ana can choose \[ B = s_1\underbrace{aa\ldots a}_k s_2\]to win. Any subsequence of $B$ which is $A$ must be of the form $s_1as_2$. Since the last letter of $s_1$ is not $a$, and the first letter of $s_2$ is not $a$, the only way to get $s_1$ from $B$ is by taking the first substring $s_1$, and similarly we can only get $s_2$ by taking the ending $s_2$ substring. That leaves $k$ options for which $a$ to choose in the middle, which means there are exactly $k$ subsequences of $B$ which are $A$. Now let us tackle the only if direction. We will show the contrapositive; if every letter of $A$ is the same as at least one of its neighbors, then $A$ does not work. Suppose FTSOC that for all $k$, there exists $B$ such that there are exactly $k$ subsequences of $B$ which are $A$. Consider $k=2$; that is, it is suppose there exists a string $B$ which has exactly 2 subsequences which are $A$. We claim we can generate another subsequence $S$. Let $m$ be the length of $A$. Let the two subsequences be $X$ and $Y$. Let the two subsequences be different till position $j$, at which point, every letter of the subsequences are at the same positions. In other words, $X_i$ and $Y_i$ are in different positions for all $1\le i \le j-1$, but are in different positions for all $j\le i \le m$. WLOG suppose $Y_j$ is after $X_j$. Note that $j \not = m$ since the two subsequences are distinct. Construct $S$ as follows. Let the first $m-1$ letters of $S$ be the first subsequence, except for the last letter. Since the second subsequence ends after the first one, let the final letter of $S$ be the last letter of the second subsequence, which we know is the last letter of $A$. This is a new subsequence which is $A$, so it is impossible to have exactly 2 subsequences which are $A$. $\blacksquare$
19.11.2019 17:15
Define a run to be a consecutive string of identical letters; for example, AABCCC contains 3 runs- a run of length 2 (AA), followed by a run of length 1 (B), followed by a run of length 3 (CCC). I claim that Ana will win no matter what iff the word she chooses contains a run of length 1. "If" part: Suppose that Ana chooses word $W$ which has a run of length 1, and then Banana chooses $k$. Now let $R$ be a run of length 1 in $W$, and WLOG let the letter of $R$ be A: then, Ana can create a new word $X$ by copying $W$ and then inserting a string of $k-1$ A's right after the A which was originally in $R$. Now note that apart from the letter in $R$, every other letter in $W$ corresponds to exactly one letter in $X$, meaning that in order to choose a subsequence $S$ of $X$ equal to $W$, all the letters in $S$ except for the one in $R$ are already fixed. Since there are $k$ A's that could be used as the letter of $R$ in $S$, there are $k$ ways to choose a subsequence $S$ of $X$ that is equal to $W$, and our construction works. "Only if" part: Suppose that Ana chooses word $W$ which does not have a run of length 1. I claim that if Banana chooses $k=2$, then Ana cannot supply a word $X$ that contains exactly 2 subsequences of length $W$. So suppose, for the sake of the contradiction, that Ana can supply such a $X$; then, let $P$ and $Q$ be these two subsequences, and let $x_i$ be the $i$th letter in $X$. Now, suppose that the first $n$ runs in $P$ and $Q$ are the same, where $n$ is less than the total number of runs in $W$; then, let the $n+1$th run in $P$ be $\overline{x_{i_1}x_{i_2}...x_{i_m}}$ and the $n+1$th run in $Q$ be $\overline{x_{j_1}x_{j_2}...x_{j_m}}$, where $m$ is the length of that corresponding run in $W$. Since $P, Q$ are distinct, we have the set $T=\{x_{i_1}, x_{i_2}, ..., x_{i_m}\}\cup \{x_{j_1}, x_{j_2}, ..., x_{j_m}\}$ contains at least $m+1$ distinct elements (we consider two letters in $X$ distinct/distinguishable if they are in different positions). Now WLOG suppose that $i_m\ge j_m$, and note that if we copy down $P$ but replace the $n+1$th run with any $m$ elements from $T$, then this string will be a subsequence in $X$ that is equal to $W$. Thus, since there are at least $m+1$ elements in $T$, there are at least $\binom{m+1}{m}=m+1\ge 3$ subsequences in $X$ equal to $W$, which is a contradiction and we are done. $\blacksquare$
08.12.2019 19:13
Let $S=[a_1a_2...a_n]$ the initial word chosen by Ana. We claim that Ana wins if and only if there exists $i \in \{1,2,...,n\}$ such that $a_i \neq a_{i-1},a_{i+1}$. Note that if this $i$ exists, Ana chooses the word $W=[a_1a_2...a_{i-1}\overbrace {a_ia_i...a_i}^{k} a_{i+1}...a_n]$, with $a_i$ appearing exact $k$ times in the indicated part in $W$. Clearly, since $a_i \neq a_{i-1},a_{i+1}$, $W$ will consist of exactly $k$ subsequences that form $S$ in $W$. Now, we prove that if this $i$ doesn't exists, then Ana loses. Therefore, for all $i \in \{1,2,...,n\}$, $a_i=a_{i-1}$ or $a_i=a_{i+1}$ $(*)$.Denote by $f(W)$ the total of subsequences of letters in $W$ that form the word $S$. Now, if we choose a letter $b_j$, and we add $b_j$ on a word $U=[b_1b_2...b_m]$ that satisfies $(*)$ (forming a word $U'$, if the neighbors of $b_j$ in $U'$ are distinct of $b_j$, by $(*)$, we have that $f(U)=f(U')$ $(**)$. Then, for $f(S)=1$ increase, we have to add a letter $a_j$ in a set of consecutive letters that are equal to $a_j$ in $S$, forming the word $S'$. Let $M$ the number of consecutive letters in the set chosen. By $(*)$, $M \geq 2$, and by construction of $S'$, $f(S') \geq \binom{M+1}{M}=M+1 \geq 3$, so Ana never can choose a word $W$ such that $f(W)=2$. Therefore, if Banana choose $k=2$, Ana loses. Then, Ana wins if and only if there exists $i \in \{1,2,...,n\}$ such that $a_i \neq a_{i-1},a_{i+1}$.
23.03.2020 21:37
Let the word Ana picks be $x_1x_2 \dots x_n$, where $x_1, x_2, \dots , x_n$ are the individual letters in the word. In addition, let us group the letters into blocks of same letters $X_1X_2 \dots X_m$. For instance, the word "AAABCC" has $X_1=AAA, X_2=B, X_3=CC$. Let us say that group of letters $X_i$ is lonely if it has exactly one letter. I claim that Ana wins if and only if she chooses a word with a lonely group. First we show that if Ana picks such a word, then she indeed wins no matter what $k$ Banana chooses. Let the word she picks be $X_1X_2 \dots X_{i-1}x_iX_{i+1} \dots X_m$, where $x_i$ is the letter in a lonely group. Consider the word $$X_1X_2 \dots X_{i-1}x_ix_i \dots x_ix_iX_{i+1} \dots X_m$$, where the letter $x_i$ is repeated $k$ times. I claim that this word has exactly $k$ subsequences which are equal to Ana's word. Consider trying to pick such a subsequence, starting with picking the $x_i$. Note that we must pick it from the duplicated section; otherwise, there is not enough room to fit in the remaining letters. Now consider trying to pick the rest of the word. By definition, the adjacent letters to $x_i$ are not of the same type. Thus we cannot pick anything else from the duplicated section; this means the rest of the subsequence is fixed and must be exactly $X_1X_2 \dots X_{i-1}$ and $X_{i+1} \dots X_m$. Thus Ana just has to pick one out of the $k$ duplicated letters, so there are exactly $k$ subsequences, as claimed. Now we show that if Ana picks a word $X_1X_2 \dots X_m$ without any lonely groups, then she cannot supply a word with $k=2$. To do this, we show that if a word $W$ has two distinct subsequences $S_A=X_{1,A}X_{2,A}X_{3,A} \dots X_{m,A}$ and $S_B=X_{1,B}X_{2,B}X_{3,B} \dots X_{m,B}$, then it must also have a third subsequence. Pick some $i$ such that $X_{i,A}$ and $X_{i,B}$ do not take their letters from the exact same spots in $W$. Let the number of letters in $X_{i,A}$ and $X_{i,B}$ be $\ell$. Then when taken together, $X_{i,A}$ and $X_{i,B}$ must take their letters from at least $\ell+1$ distinct spots in $W$. Since we assumed that no group was lonely, we must have $\ell \geq 2$, so $\binom{\ell+1}{\ell} = \ell+1 \geq 3$. Thus we can select a third group $X_{i,C}$ from these $\ell+1$ letters such that $X_{i,C}$ takes its letters from different places than $X_{i,A}$ and $X_{i,B}$. It is easy to see that there will always still be room left over to fill in the rest of the word and make a subsequence $X_{1,C}X_{2,C} \dots X_{m,C}$. Thus we can always pick a third distinct subsequence, and so Ana loses if Banana picks $k=2$, as desired.
25.03.2020 01:48
Call a contiguous substring of a distinct letter of length $n$ an $n$-worm. For example, AAA is a $3$-worm, and AAB is a $2$-worm followed by a $1$-worm. I claim that any valid string produced by Ana must contain a $1$-worm A valid construction is as follows. Suppose that Ana's original string is $S = a_1a_2 \dots a_n$, a sequence of worms $a_i$, where WLOG $a_1$ is a $1$-worm. Then, note that the string $$\underbrace{a_1 \dots a_1}_{\text{k times}} a_2 \dots a_n$$produces $k$ subsequences which all are $S.$ Now we will show that no strings $S$ with no $1$-worms work. In fact, if Banana chooses $k = 2$, I claim that Ana cannot find a valid word. Assume for the sake of contradiction that Ana is able to produce a valid word, call it $S'.$ Note that $S'$ is formed by inserting various letters into the already existing $S$. Look at an arbitrary worm $a_i$, consisting only of letters $b_i$. Clearly, in order to form a new subsequence, the letter $b_i$ must be appended to a worm $a_j$ consisting only of letters $b_i$. Next, suppose we only add $1$ letter; in fact, this the given $k$. To finish, note that any valid subsequence must follow $a_1 \dots a_n$, and WLOG say that $b_i$ is inserted next to $a_i$, meaning $S' = a_1 \dots a_i b_i \dots a_n$. Say that $a_i$ is a run of length $k$. Then, we can choose $k$ $b_i$s from $S'$ in ${k + 1 \choose k} = k + 1 \ge 3$ ways, and fix the rest of the subsequence, as no new terms are added. For further clarity, let $c_1 \dots c_{k+1}$ denote each of the $b_i$s. Then the subsequences \begin{align*} a_1 a_2 \dots c_1 \dots c_{k} \dots a_n \\ a_1 a_2 \dots c_2 \dots c_{k+1} \dots a_n \\ a_1 a_2 \dots c_1 c_3 \dots c_{k+1} \dots a_n \end{align*}all work, meaning we are done.
23.04.2020 21:44
I think the write-up is most of the work on this problem; seems pretty easy for a TSTST #2 Let a block be a consecutive subsequence of letters in a word of maximal length such that it comprises entirely of one distinct letter. Let the length of a block be the number of letters a block contains. For example, the word $AABBB$ contains a block of length $2$, followed by a block of length $3$. Note that the subsequence $BBB$ cannot be split into two blocks of lesser length, since blocks have the greatest size possible. We claim the words that guarantee Ana's win are those who contains a block of length $1$. Let the word Ana chooses be $W$, and let $k$ be the number Banana chooses. We first prove that all words of this form guarantee Ana's win. For the case $k=0$, we can produce any word that doesn't contain $W$, and win. We can now work under the assumption that $k \geq 1$. WLOG, let the letter of the earliest block of length $1$ in the sequence be filled with $A$s, and call the block $B$. We append $k-1$ $A$s to the end of that block, and keep every other block the same. This new construction produces $k$ different subsequences of $A$s, since we can only get the portion of $W$ before the block of length $1$ in one way. Similarly, we can only get the portion of $W$ after the block of length $1$ in one way. There are $k$ $A$s in $B$, and we must choose $1$ of them, so we have $k$ subsequences. Now, we claim that any word with minimum block length of $2$ cannot win for the value of $k=2$. For the sake of contradiction, suppose we could construct a word $P$ with exactly $2$ distinct subsequences of $W$, which we will call $S_1$ and $S_2$. Since $S_1$ and $S_2$ are distinct, one of their blocks, which we will call $B_1$ and $B_2$, retrieved its letters from a different source in a block in $P$. Let the number of letters in $B_1$ and $B_2$ be $x$, and WLOG let the letter be $A$. There must be at least $x+1$ instances of $A$ in $B_1$ and $B_2$ in $P$, so there are $\binom{x+1}{x} = x+1$ ways to find $x$ $A$s to construct a subsequence. To complete the rest of the subsequence, we can now take all the positions of the letters in $S_1$ excluding $B_1$. This means we have at least $x+1$ ways to construct such a sequence. However, recall that $x\geq 2$, so there must be at least $3$ subsequences, contradiction.
14.07.2020 00:56
in my opinion, competitive programming helps with these types of problems. oops my latex is bad.
29.11.2020 00:38
Define a "block" of words as $n$ consecutive identical letters, and let the length of such a block be equal to $n$. Ana can guarantee a win if and only if the shortest block in her initial pick has length 1. To verify the "if" part: For any $k$ that Banana chooses, Ana can replace such a block of length 1 with $k$ concatenated copies of itself. To verify the "only if" part: Suppose that Banana picks 2 and assume FTSOC that Ana supplies a word with the substrings $a_1a_2\ldots a_i$, $b_1b_2\ldots b_i$. Let the least index $j$ such that $a_j,b_j$ are in distinct positions of Ana's second word be equal to $m$. Also, let the block in Ana's first word containing the index $m$ be of length $l\ge 2$ and end at the index $m+c$. Then, we would be able to construct subsequences by taking $l$ elements of the set $\{a_{m+c-(l-1)},a_{m+c-(l-2)}\ldots a_{m+c}\}\cup\{b_{m+c-(l-1)},b_{m+c-(l-2)}\ldots b_{m+c}\}$, and following them with the letters between $a_{m+c+1}$ and $a_i$ if $a_{m+c+1}$ appears after $b_{m+c+1}$ in the second word Ana supplies and $b_{m+c+1}$ to $b_i$ otherwise. This gives at least $\binom{l+1}{l}=l+1$ substrings, which is greater than 2 and thus Ana loses.
29.11.2020 05:13
laegolas wrote: Call the first word Ana chooses $S=s_1s_2s_3\dots s_n$, and the second word she must supply $W=w_1w_2w_3\dots w_n$. Ana wins if and only if she chooses an $S$ with an $s_m$ such that $s_{m-1}\neq s_m\neq s_{m+1}$. (We define $s_m\neq s_i$ for nonexistent $s_i$). For the "if" part, Ana's winning construction is easy. Given any $k$, and any element $s_m$ such that $s_{m-1}\neq s_m\neq s_{m+1}$, Ana supplies the word $W=w_1w_2w_3\dots w_{n+k-1}$ where $w_i=s_i$ for $1\le i\le m-1$, $w_i=s_m$ for $m\le i\le m+k-1$, and $w_i=s_{i-k+1}$ for $m+k\le i\le n+k-1$. Then all terms $s_i$ with $i\neq m$ will have a fixed corresponding $w_i$ term, and $s_m$ will have exactly $k$ options for its corresponding $w_i$ term, meaning $W$ has exactly $k$ sub-sequences $S$. For example, if $$S=\overbrace{AA\dots AA}^{a \text{ As}} B \overbrace{CC\dots CC}^{c \text{ Cs}}$$then $$W=\overbrace{AA\dots AA}^{a \text{ As}} \overbrace{BB\dots BB}^{k \text{ Bs}} \overbrace{CC\dots CC}^{c \text{ Cs}}$$always wins.$\square$ For the "only if" part, suppose there does not exist a term $s_m$ such that $s_{m-1}\neq s_m\neq s_{m+1}$. We claim that Ana is guaranteed to lose if Banana sets $k=2$. Suppose that Ana finds $2$ sub-sequences $S_a$ and $S_b$ such that $$S_a=W_{a_1}W_{a_2}W_{a_3}\dots W_{a_n}$$$$S_b=W_{b_1}W_{b_2}W_{b_3}\dots W_{b_n}$$We claim that there must exist a third valid sub-sequence $S_c$ distinct from $S_a$ and $S_b$. Let $j$ be the smallest $i$ such that $a_i\neq b_i$, and WLOG let $a_j<b_j$. Case 1: $a_{j+1}=b_{j+1}$. If $s_j=s_{j+1}$, then there is the valid $$S_c=W_{a_1}\dots W_{a_j}W_{b_j}W_{b_{j+2}}\dots W_{b_n}$$and Ana loses. If $s_j=s_{j-1}$, then there is the valid $$S_c=W_{a_1}\dots W_{a_{j-2}}W_{a_j}W_{b_j}\dots W_{b_n}$$and Ana loses. By our original at least one of $s_j=s_{j+1}$ and $s_j=s_{j-1}$ is true, so in this case Ana loses either way as there must exist a third sub-sequence $S_c$ distinct from $S_a$ and $S_b$. Case 2: $a_{j+1}\neq b_{j+1}$. Then there is the valid $$S_c=W_{a_1}\dots W_{a_j}W_{b_{j+1}}\dots W_{b_n}$$and Ana loses as this sequence is distinct from $S_a$ and $S_b$. We have covered both cases and shown that $\ge 2$ sub-sequences $S$ implies $\ge 3$ sub-sequences $S$. Thus Ana can never find a word $W$ with exactly 2 sub-sequences $S$, and is then guaranteed to lose in the "only if" case. We have shown our winning condition is both necessary and sufficient, and we are done. $\blacksquare$ why you know the answer is $s_m-1\nes_m\nes_m+1$?
13.01.2021 19:02
Let the first word be $A_1A_2\ldots A_n$ and the second word be $B_1B_2\ldots B_m$. We claim that if there exists $i$ such that $A_{i-1}\neq A_i$ and $A_i \neq A_{i+1}$ (if $A_j$ doesn't exist then it's not equal to anything) then Ana wins, otherwise Banana wins. If there exists such an $i$, Ana can choose the following word: $$A_1A_2\ldots A_{i-1}\underbrace{A_i A_i \ldots A_i}_{k \text{ copies}}A_{i+1} \ldots A_n$$We clearly see that we can pick $k$ working subsequences: one for each choice of the $A_i$ in the underbracketed string. Now observe that we cannot have any other subsequences, since each letter not in the underbracketed string corresponds uniquely to a letter in the first word, and therefore cannot be removed from the substring (and therefore we can only pick one letter from the underbracketed string). Now we will show that if such an $i$ does not exist, then Banana can win by picking $k=2$. To do this, we will demonstrate that if there are two subsequences, then there is always a third subsequence which can be chosen. Suppose there exist two distinct valid subsequences $$B_{p_1}B_{p_2}\ldots B_{p_n}$$$$B_{q_1}B_{q_2}\ldots B_{q_n}$$where $p_i$ and $q_i$ are strictly increasing sequences. Now let $i$ be the least positive integer such that $p_i \neq q_i$. Then we can rewrite the subsequences as: $$B_{p_1}B_{p_2}\ldots B_{p_{i-1}} B_{p_i}B_{p_{i+1}}\ldots B_{p_n}$$$$B_{p_1}B_{p_2}\ldots B_{p_{i-1}} B_{q_i}B_{q_{i+1}}\ldots B_{q_n}$$We now consider the following cases: Case 1: The sequences $p_{i+1},p_{i+2},\ldots,p_n$ and $q_{i+1},q_{i+2},\ldots,q_n$ are identical. Then we can rewrite the second subsequence as $$B_{p_1}B_{p_2}\ldots B_{p_{i-1}} B_{q_i}B_{p_{i+1}}\ldots B_{p_n}$$Now since all $A_i$ must be equal to at least one of their adjacent letters, we have $B_{p_i}=B_{q_i}=B_{p_{i-1}}$ or $B_{p_i}=B_{q_i}=B_{p_{i+1}}$. We use the following subcases: Subcase 1: $B_{p_i}=B_{q_i}=B_{p_{i-1}}$. Then $$B_{p_1}B_{p_2}\ldots B_{p_{i-2}} B_{\min (p_i,q_i)} B_{\max (p_i,q_i)}B_{p_{i+1}}\ldots B_{p_n}$$works, since $\min(p_i,q_i) \neq p_{i-1}$, as $p_i,q_i>p_{i-1}$. Subcase 2: $B_{p_i}=B_{q_i}=B_{p_{i+1}}$. Then $$B_{p_1}B_{p_2}\ldots B_{p_{i-1}}B_{\min(p_i,q_i)}B_{\max (p_i,q_i)}B_{p_{i+2}}B_{p_{i+3}}\ldots B_{p_n}$$works, since $\max (p_i,q_i) \neq p_{i+1}$, as $p_i,q_i<p_{i+1}$. Case 2: The sequences $p_{i+1},p_{i+2},\ldots,p_n$ and $q_{i+1},q_{i+2},\ldots,q_n$ are different. If $p_i<q_{i+1}$, then the subsequence $$B_{p_1}B_{p_2}\ldots B_{p_{i-1}}B_{p_i}B_{q_{i+1}}B_{q_{i+2}}\ldots B_{q_n}$$works, since it differs from the first because the sequences $p_{i+1},p_{i+2},\ldots,p_n$ and $q_{i+1},q_{i+2},\ldots,q_n$ are different and from the second because $p_i \neq q_i$. If $p_i>q_{i+1}$, then $q_i<p_{i+1}$. So, the subsequence $$B_{p_1}B_{p_2}\ldots B_{p_{i-1}}B_{q_i}B_{p_{i+1}}B_{p_{i+2}}\ldots B_{p_n}$$works, since it differs from the first because $q_i \neq p_i$ and from the second because the sequences $p_{i+1},p_{i+2},\ldots,p_n$ and $q_{i+1},q_{i+2},\ldots,q_n$ are different. Together, these cases show that Banana can win with $k=2$ if Ana picks a word such that for every $i$, we have either $A_{i-1}=A_i$ or $A_i=A_{i+1}$, as desired. $\blacksquare$
20.03.2021 09:29
For a word, consider its ``blocks''; maximal contiguous substrings. We claim a word is valid of and only if it has a block of length 1. Construction Consider a word $A$ with a block $a$ of length 1. Suppose $A=waw'$ for some letter $a$ and words $w$ and $w'$, with the final letter of $w$ and the first letter of $w'$ not equal to $a$. Then Ana can choose $w\underbrace{aa\ldots a}_{\times k}w'$ for any $k\ge 1$, which has clearly exactly $k$ subsequences equal to $waw'$. Proof of necessity Consider the set of words $A$ with each block of length at least 2. We claim these are all invalid; in particular that $k=2$ does not work. Induct on the number of blocks. Base case: If there is one block, then the word is $A=\underbrace{aa\cdots a}_{\times n}$ for some letter $a$ and $n\ge 2$. Any word $B$ which has more than 1 subsequence equal to $A$ must have at least $n+1$ $a$'s, so in fact has at least $\tbinom{n+1}{n}=n+1\ge 3$ subsequences equal to $A$, proving $k=2$ does not work. Induction step: Suppose there at least two blocks in the initial word $A$, and the first block is $\underbrace{aa\ldots a}_{\times n}$, and the second block is $\underbrace{bb\ldots b}_{\times m}$. Suppose there exists a word $B$ which has exactly 2 subsequences equal to $A$. Iterate one letter at a time from the left till we hit $n$ $a$'s, and keep going after that till we hit a $b$. \[ B=w_1\ a\ w_2\ a\ w_3\cdots w_\ell \ a \ W \ b\cdots.\]Note that $w_1,\ldots,w_\ell$ have no $a$'s. Also, $W$ cannot have any $a$'s; else there would be at least than 3 subsequences equal to $A$ (similar to the base case). Let $A'$ be $A$ with the first block of $a$'s chopped off, and let $B'$ be $B$ but with everything in $B$ before the first $b$ chopped off. Then $B'$ has exactly 2 subsequences equal to $A'$, but this is impossible by the inductive hypothesis. This completes the induction.
01.05.2021 00:45
Ana can always win if she picks a word such that there is a letter in the word that is different from both the letters directly in front and behind it. First I will show that this works. Denote a word as $\overline{x_1x_2\dots x_n}$, where each $x_i$ is a letter. Let $x_j$ be the letter that is different from both the letters directly in front and behind it. For each $k$, the word that Ana should supply is \[\overline{x_1x_2\dots x_{j-1}\underbrace{x_j x_j\dots x_j}_\text{k times} x_{j+1} \dots x_n}.\]Then, the $k$ desired subsequences consist of the letters $x_1$ through $x_{j-1}$, one of the $x_j$ (for which there are $k$ choices), and the letters $x_{j+1}$ through $x_n$. No other subsequences exist because both the subsequences $\overline{x_1x_2\dots x_{j-1}}$ and $\overline{x_{j+1}\dots x_n}$ must both be chosen from the word that Ana supplies. Now I will prove that if Ana picks a word such that there isn't a letter in the word that is different from both the letters directly in front and behind it, she can lose. In particular, she will lose if $k=2$ is chosen. Denote the original word that Ana picks as $s_1,$ and the word that Ana later supplies in response to Banana be $s_2.$ For the sake of contradiction, assume there are exactly 2 subsequences of $s_1$ in $s_2.$ There exists a letter $x_j$ in $s_1$ that appears at least twice in a row. Say that it appears at least $y$ times in a row. Then, $x_j$ must appear at least $y+1$ times in $s_2$. However, this also means that $\binom{y+1}{y}=y+1$ subsequences equivalent to $s_1$ can be chosen. But $y+1>2$ so it is impossible for there to be exactly 2 subsequences of $s_1$ in $s_2$. Hence if $k=2$ is chosen Ana cannot win. Therefore Ana must chose a word such that there is a letter in the word that is different from both the letters directly in front and behind it.
02.08.2021 11:20
New Comments - 7/23/23: I now realize that there are a couple of flaws in this solution. First of all, an explanation for why picking one copy of $L_a$ from $C_a$ in the construction is necessary and determines the rest of the subsequence is required. Also, I should have written the following statements later on in my proof: It's easy to see the number of distinct possibilities for $C_i$ (ignoring other chunks) in a subsequence is $\binom{|S_i|}{|C_i|}$, as all of the chunks of $W_i$ which occur before $C_i$ must be contained in $B_i$ before the first letter of $S_i$ appears and similarly for the chunks of $W_i$ which occur after $C_i$. Since we want $k = 2$, it's easy to see $\binom{|S_i|}{|C_i|} \in \{1, 2\}$ must hold for all $C_i \in W_i$. Define a chunk of some word to be a subsequence of that word consisting of consecutive identical letters, such that the letters adjacent to the first and last letters of the chunk (outside of the chunk) are not identical to the letters in the chunk. Example: Given the word $AAAABBCCCDAA$, we know the set $$\{AAAA, BB, CCC, D, AA\}$$contains all of its chunks (in order). In particular, subsequences such as $AAA$ are not chunks of this word. It's easy to see all words consist of a (non-empty) series of consecutive pairwise non-intersecting chunks. We claim Ana can always win iff her word $W_a$ contains a chunk of length $1$. First, we show all such words are winners. It's trivial to see $k = 0$ is always possible. Now, let $C_a$ be a chunk of $W_a$ with length $1$ only containing the letter $L_a$. Now, we construct the word $B_k$ as follows: Start with $W_a$ (where everything is the same as before). Now, add $k-1$ copies of $L_a$ to $C_a$ while keeping everything else untouched. It's easy to see $B_k$ has $k$ subsequences equal to $W_a$. Since all $k \ge 1$ is possible, we're done. Now, suppose Ana's word $W_i$ only consists of chunks of length at least $2$. We will show it's impossible to pick a word $B_i$ with $k = 2$ subsequences equal to $W_i$. For each chunk $C_i \in W_i$, define $S_i$ to be the set of all individual letters in $B_i$ that could be a part of $C_i$ (in some valid subsequence of $B_i$ equal to $W_i$). It's easy to see the number of distinct possibilities for $C_i$ (ignoring other chunks) in a subsequence is $\binom{|S_i|}{|C_i|}$, where $|C_i|$ denotes the length of $C_i$. Since we want $k = 2$, it's easy to see $\binom{|S_i|}{|C_i|} \le 2$ must hold for all $C_i \in W_i$. Because $|C_i| \ge 2$, however, we know the only possibility is $|S_i| = |C_i|$. (This can be seen by bounding $\binom{n}{i}$ for $n \ge i \ge 2$.) But $|S_i| = |C_i|$ for all $C_i \in W_i$ implies that there's exactly $1$ subsequence of $B_i$ equal to $W_i$ (as everything is fixed). This is obviously a contradiction, so we've shown all words only consisting of chunks of length at least $2$ are losers for Ana. $\blacksquare$ Remarks: My notation and definition of a chunk is probably subpar compared to previous solutions posted on this thread. The overall method I use, especially the bounding, is very similar to others' ideas, however. Also, isn't the construction trivial? Unless I'm missing something, I don't see why others are explaining the construction with so much detail.
09.08.2021 09:07
For Storage: We claim that Ana can choose any word except the words without a letter $'X'$ which lies between two other letters $'Y'$ and $'Z'$, $X \neq Y$, $Y \neq Z$. First, we prove that she can always win if she has such a letter $'X'$. Let the word Ana chooses be, $$\underbrace{a_1a_1 \cdots a_1}_{b_1 \text{ times}}\underbrace{a_2a_2 \cdots a_2}_{b_2 \text{ times}}a_3\cdots \underbrace{a_ka_k \cdots a_k}_{b_k \text{ times}}X\underbrace{a_{k+1}a_{k+1} \cdots a_{k+1}}_{b_{k+1} \text{ times}}\cdots a_n$$where $b_i \geq 2$ and $X \neq a_k, a_{k+1}$. Suppose Banana chooses the number $j$. Ana will just add $j - 1$ more $X$'s between $a_k$ and $a_{k+1}$. Suppose the $j$ $X$'s be $X_1$, $X_2$, $\cdots$ $X_j$. Since $X \neq a_k, a_{k+1}$, adding $j-1$ letters will increase the number of sub-sequences by $j-1$ and originally she had $1$ sub-sequence which was the sequence itself but now she has the desired $j$ number of sub-sequences namely $$\underbrace{a_1a_1 \cdots a_1}_{b_1 \text{ times}}\underbrace{a_2a_2 \cdots a_2}_{b_2 \text{ times}}a_3\cdots \underbrace{a_ka_k \cdots a_k}_{b_k \text{ times}}X_1\underbrace{a_{k+1}a_{k+1} \cdots a_{k+1}}_{b_{k+1} \text{ times}}\cdots a_n$$$$\underbrace{a_1a_1 \cdots a_1}_{b_1 \text{ times}}\underbrace{a_2a_2 \cdots a_2}_{b_2 \text{ times}}a_3\cdots \underbrace{a_ka_k \cdots a_k}_{b_k \text{ times}}X_2\underbrace{a_{k+1}a_{k+1} \cdots a_{k+1}}_{b_{k+1} \text{ times}}\cdots a_n$$$$\vdots$$$$\underbrace{a_1a_1 \cdots a_1}_{b_1 \text{ times}}\underbrace{a_2a_2 \cdots a_2}_{b_2 \text{ times}}a_3\cdots \underbrace{a_ka_k \cdots a_k}_{b_k \text{ times}}X_j\underbrace{a_{k+1}a_{k+1} \cdots a_{k+1}}_{b_{k+1} \text{ times}}\cdots a_n$$ Now we prove that she can't win if she doesn't have such a letter $X$. Let the word she chooses be $$\underbrace{a_1a_1 \cdots a_1}_{b_1 \text{ times}}\underbrace{a_2a_2 \cdots a_2}_{b_2 \text{ times}}a_3\cdots \underbrace{a_ka_k \cdots a_k}_{b_k \text{ times}}\underbrace{a_{k+1}a_{k+1} \cdots a_{k+1}}_{b_{k+1} \text{ times}}\cdots a_n$$where $b_i \geq 2$ and $a_i \neq a_{i+1}$, $1 \leq i \leq n-1$. Claim: Ana loses if Banana asks for $k=2$. Suppose Banana asks for $k = 2$. If Ana appends a letter in a string of the same letter, then she gets ${b_i+1 \choose b_i} = b_i +1$ but $b_i \geq 2 \Rightarrow {b_i+1 \choose b_i} \geq 3$. So she can't achieve two subsequence by doing this. The only other way is to add letters in between two strings of letters which are different. Suppose we add the letter $a_m$ in between strings of letters $a_i$ and $a_{i+1}$ and $a_m \neq a_i, a_m \neq a_{i+1}$. Let the word after adding the letter be $$\underbrace{a_1a_1 \cdots a_1}_{b_1 \text{ times}}\underbrace{a_2a_2 \cdots a_2}_{b_2 \text{ times}}a_3\cdots \underbrace{a_ia_i \cdots a_i}_{b_i \text{ times}}a_m\underbrace{a_{i+1}a_{i+1} \cdots a_{i+1}}_{b_{i+1} \text{ times}}\cdots \underbrace{a_ma_m \cdots a_m}_{b_m \text{ times}}\cdots a_n$$But it turns out that she can't form more than $1$ sub-sequences out of it because the position of $a_m$ is such that we can't use it since she misses out on some letters which form the original word and if she adds multiple such letters in between various strings, she clearly will get way more than $2$ subsequences. So Ana will clearly lose if Banana asks for $k=2$.
10.08.2021 14:30
Answer :Ana definitely wins if she supplies a word which has a letter that is different from its neighbours Solution:Let the original word be $\underbrace{a_1a_1 \cdots a_1}_{m_1 \text{ times}}\cdots \underbrace{a_ka_k \cdots a_k}_{m_k \text{ times}}\cdots \underbrace{a_na_n \cdots a_n}_{m_n \text{ times}}$. FTSOC assume that $m_i \geq 2 \forall i$. Also choose $k=2$. Let the letters added to construct the new string be called $b_i$ if their value is $a_i$. We find $\geq 3$ substrings as follows : Choose the substring with all $a_i$s. By assumption we added the $b_i$s such that we can find one more substring (consisting of some of these $b_i$s) equal to the original substring. Let's say we chose $\underbrace{a_la_l\cdots a_l}_{m_l-1 \text{ times}} b_l$ somewhere in the new string. Next we could just use the $a_i$ we didn't previously and not use an $a_i$ we did (this is clearly possible since $m_i \geq 2 \forall i$.) So we get $\geq 3$ subsequences equal to the initial word. Now what's left is a construction when $\exists i$ such that $m_i=1$. To do that, add $x b_i$s just after $a_i$ if $k=x$. It's easy to see this works and we are done $\blacksquare$
10.08.2021 23:34
My absolutely terrible writeup: Define a flush of a string as a nonempty string of adjacent letters of the same kind. Define a block $A$ of a string as a flush of the string such that the only flush that contains $A$ as a substring is $A$ itself. We claim that Ana will win if and only if she picks a word that has a block of length $1$. For the if direction, suppose the word $A$ Ana chooses is comprised of blocks $A_1,A_2,\ldots,A_n$ such that $A_m$, with $1 \leq m \leq n$, is of length $1$. We claim that she can supply the word $$A'=A_1A_2 \cdots A_{m-1}A_mA_m \cdots A_mA_{m+1} \cdots A_n,$$where $A_m$ is repeated $k$ times. There are $n$ blocks in both $A$ and $A'$. Clearly, no subsequence of $A'$ equal to $A$ can skip a block, since then there wouldn't be enough blocks left to contain the rest of $A$. Thus, every block in $A$ must fit into its corresponding block in $A'$. All blocks other than $A_m$ fit snugly into its corresponding block, but there are $k$ choices for $A_m$, so there are $k$ subsequences equal to $A$. For the only if direction, supposed the word $A$ Ana chooses is comprised of blocks $A_1,A_2,\ldots,A_n$ of length at least $2$. We claim that it is impossible to supply a word $A'$ that has exactly $2$ subsequences equal to $A$. Suppose $A'$ has at least $2$ subsequences equal to $A$. Let $A_m$ be the first block of $A$ such that the positions of $A_m$ on $A'$ are different for the $2$ sequences. Let $k \geq 2$ be the length of $A_m$. Then, consider the subsequence such that the first letter of $A_{m+1}$ is later than or at the same position than the other subsequence. There exist at least $\dbinom{k+1}{k}=k+1>2$ subsequences that are the same as $A$ by taking the subsequence previously mentioned and choosing $k$ out of at least $k+1$ letters. Thus, there is no word with exactly $2$ subsequences equal to $A$ and we are done.
12.08.2021 15:52
Call a word good if there exists a letter $X$ whose neighbours are different from $X.$ We claim that the only words for which Ana wins regardless of the value of $k$ are good words. Assume Ana wins regardless of $k$ for a word $\mathcal{W}.$ We let $k=2.$ Consider the word $\overline{\mathcal{W}}$ which has precisely two $\mathcal{W}-$subwords. We may WLOG assume that each letter of $\overline{\mathcal{W}}$ is one of the letters of one of the two $\mathcal{W}-$subwords. Now, let the two $\mathcal{W}-$subwords. of $\overline{\mathcal{W}}$ be $\mathcal{W}_1=X_1X_2\dots X_n\text{ and }\mathcal{W}_2=Y_1Y_2\dots Y_k$ where $X_1,X_2,...,Y_k$ are letters of $\overline{\mathcal{W}}.$ We say that $A=B$ if they are the same letter of $\overline{\mathcal{W}}$ (i.e. if they lie on the same position of $\overline{\mathcal{W}}$). We claim that there exists exactly one index $i$ such that $X_i\neq Y_i.$ If there are none, then $\mathcal{W}_1=\mathcal{W}_2,$ a contradiction. Now, assume there are at least two such indices and let the smallest be $i<j.$ Then, there exist (possibly empty) subwords $\mathcal{S}_1,\mathcal{S}_2,\mathcal{V}$ and $\mathcal{U}$ of $\overline{\mathcal{W}}$ such that \[\mathcal{W}_1=\mathcal{S}_1 \ X_i \ \mathcal{S}_2 \ X_j \ \mathcal{U}\text{ and }\mathcal{W}_2=\mathcal{S}_1 \ Y_i \ \mathcal{S}_2 \ Y_j \ \mathcal{V}.\]However, we can then consider $\mathcal{W}_3=\mathcal{S}_1 \ X_i \ \mathcal{S}_2 \ Y_j \ \mathcal{V}.$ This clearly is a subword of $\overline{\mathcal{W}}$ and since $X_i\neq X_j$ and $Y_i\neq Y_j$ then $\mathcal{W}_1\neq\mathcal{W}_3$ and $\mathcal{W}_2\neq\mathcal{W}_3.$ Therefore, $\overline{\mathcal{W}}$ also has a third $\mathcal{W}-$subword, but this contradicts the win for $k=2.$ Hence, $\mathcal{W}_1$ and $\mathcal{W}_2$ only differ in one index. In other words, there exist (possibly empty) subwords $\mathcal{A}$ and $\mathcal{B}$ and letters $X$ and $Y$ of $\overline{\mathcal{W}}$ such that $\mathcal{W}_1=\mathcal{A} \ X \ \mathcal{B}$ and $\mathcal{W}_2=\mathcal{A} \ Y \ \mathcal{B}.$ Hence, $\overline{\mathcal{W}}=\mathcal{A} \ X \ Y \ \mathcal{B}$ (or $\mathcal{A} \ Y \ X \ \mathcal{B},$ but it doesn't matter). Clearly, $X$ and $Y$ must have the same letter "value", say $h.$ We then write $\mathcal{A}$ and $\mathcal{B}$ as \[\mathcal{A}=\mathcal{A}' \ \underbrace{h \ h...h}_{x\text{ times}}\text{ and }\mathcal{B}=\underbrace{h \ h...h}_{y\text{ times}} \ \mathcal{B}'.\]Then, observe that by substituting $\mathcal{A}$ and $\mathcal{B}$ in $\mathcal{W}$ and $\overline{\mathcal{W}}$ we can rewrite the latter as \[\mathcal{W}=\mathcal{A'}\underbrace{h \ h...h}_{x+y+1\text{ times}} \ \mathcal{B}'\text{ and }\overline{\mathcal{W}}=\mathcal{A'}\underbrace{h \ h...h}_{x+y+2\text{ times}} \ \mathcal{B}'.\]It is easy to see that there are at least $\binom{x+y+2}{x+y+1}=x+y+2$ $\mathcal{W}-$subwords of $\overline{\mathcal{W}}$ but since $k=2$ then $x=y=0$ so the neighbours of $h$ in $\mathcal{W}$ are different from $h$ so $\mathcal{W}$ is good. Hence, for Ana to win for $k=2, \ \mathcal{W}$ must be good. It is easy to observe that if $\mathcal{W}=\mathcal{A} \ h \ \mathcal{B}$ is good and $h$ is its lonely letter then $\mathcal{A} \ h \ h...h \ \mathcal{B}$ (with $n \ h$s) wins for $k=n.$ Therefore, Ana wins for any $k$ for any good word. Note: My solution might be a bit confusing in terms of notation. A letter $X$ of a word $\mathcal{W}$ is not a letter $a,b,c...$ but a position of $\mathcal{W}.$ So we denote different letters (i.e. positions) of a word with different notations, even though they have the same letter value (i.e. even though they stand for the same letter from the English alphabet).
16.08.2021 23:09
19.08.2021 16:17
All words are made up of blocks of consecutive letters (for example the word "TST" contains $3$ blocks and the word "BBBBBBANANA" contains $6$ blocks). We say the length of a block is the number of letters it contains. We claim the answer is any string that contains at least one block of length 1. As a construction, Ana can simply choose any block of length $1$ and replace it with a block of length $k$ consisting of the same letter, which clearly works (For example, if given the word "TST" and $k = 4$, Ana could choose the word "TTTTST"). Now, we claim that if all blocks in Ana's word have length at least $2$, Banana can win by choosing $k = 2$. We proceed with induction on the number of blocks. For the base case ($1$ block), let Ana's original word have length $m$ and letter $L$. If she chooses a word with $n$ copies $L$, it will have $\binom{n}{m}$ subsequences equal to her original word. Clearly $\binom{n}{m}$ can never equal $2$ for $m\ge 2$. For the induction step, let Ana's initial word be $W$ with $a\ge 2$ copies of its first letter $L$ and let $W'$ be the subsequence obtained by deleting its first block. Suppose, towards contradiction, that she can choose a word $W_1$ with exactly $2$ subsequences equal to $W$. We consider only the smallest subsequence $W_2$ of $W_1$ with exactly $2$ subsequences equal to $W$. Consider the last appearence of $L$ in $W_2$. By the minimality of $W_2$ this is part of a subsequence equal to $W$. In particular, there exists a subsequence of $W_2$ equal to $W'$ appearing entirely after every copy of $L$ in $W_2$. This means that if there are $b$ copies of $L$ in $W_2$, there are at least $\binom{b}{a}$ subsequences of $W_2$ equal to $W$, forcing $b = a$ since $a\ge 2$. In particular, by the minimality of $W_2$ again, these $a$ copies of $L$ form a block in $W_2$, so we can ignore this block and apply the inductive hypothesis with $W'$.
17.09.2021 23:04
We claim that a word Ana supplies is winning if and only if there exists a letter $L$ such that the letters adjacent to $L$ are different from $L$. Call these words superior. The if direction is not too hard. Consider a superior word $\ell_1\ell_2\dots \ell_a \dots, \ell_n$ where $\ell_{a-1}, \ell_{a+1} \neq \ell_a$. The construction for the second word for a given $k$ is $$\ell_1\ell_2\dots \ell_{a-1}\underbrace{\ell_a\ell_a\dots\ell_a}_{k \text{ times}} \ell_{a+1}\dots\ell_{n}.$$To form a subsequence we must: Choose the first $a-1$ letters of the sequence Choose one of the $k$ $\ell_a$'s Choose the letters $\ell_{a+1}$ through $\ell_n$. Thus, there are $k$ possible subsequences. Now, we move to the only if part. Assume Ana chooses a non-superior word. Claim: If $k=2$, then Ana will lose. Proof. Call a block a set of consecutive same letters in a word. If Banana says $k=2$, then assume Ana supplies a word with two subsequences. Let the first word be $A_1A_2\dots A_j$ where $A_i$ are blocks.s Then, we will show that a third must exist, as well. Let the second word Ana supplies be $B_1B_2\dots B_n$. Then, let the two subsequences be $s_1$ and $s_2$. Say that the the first letter that $s_1$ and $s_2$ differ at is $L$, and $L$ is in block $A_m$. If $A_m$ has length $d \ge 2$, then the block at which $s_1$ and $s_2$ differ at in the second word must have length $x \ge d+1$. However, if we were to choose a set of letter from this block, there are $\tbinom{d+1}{d} = d+1 > 2$ possible ways to choose letters here, contradiction. $\square$ Both directions are shown, thus we are done. $\blacksquare$
29.09.2021 16:40
Badly written proof, but whatever. Let $$N=A_1A_2A_3\cdots A_n$$be the word that Ana chooses, where the $A_i$ are homogeneous words (that are only comprised of repetitions of one letter and are as long as possible.) Furthermore, let $a_i$ denote the length of the word $A_i$. We claim that Ana can only win when $a_i=1$ for at least one $i$. First, we give Ana's winning strategy. Choose a word $A_j$ such that $a_j=1$, which we know exists, and let the digit that $A_j$ represents be $d$. Then for the value fo $k$ that Banana supplies, Ana can choose the word $$A_1A_2A_3\cdots A_j \underbrace{dd\cdots d}_{k-1 \text{ letters}} A_{j+1}A_{j+2}\cdots A_n.$$It is easy to see that since we can pick any of the digits $d$ to represent the $A_j$ in our subsequence-word and all other choices are fixed, that Ana will win no matter what value of $k$ Banana chooses. Next, we prove that Ana cannot win if $a_i>1$ for all $i$. In fact, these words fail when Banana picks $k=2$. To show this, notice that for any word $W$ to contain more than one subsequence of $N$, it must be a superword of $N$, and also contain extra digits that $N$ contains. Consider any digit $d_i$ that appears more than $a_i$ times in $W$, and let $b$ be the first occurence of $d_i$ in $W$ such that the word $A_1A_2A_3\cdots A_{i-1}$ is a subsequence of the word $X$ formed by the letters in $W$ that appear before $b$, and$c$ be the last occurrence of $d_i$ in $W$ such that the word $A_{i+1}A_{i+2}A_{i+3}\cdots A_n$ is a subsequence of the word $Y$ formed by the letters in $W$ that appear after $c$. Such $b, c$ must exist in order for more than 1 subsequence of $N$ to exist in $W$. Let $x$ be the number of occurences of $d_i$ between $b$ and $c$, inclusive. However, this means that the number of subsequences of $N$ in $W$ is at least ${3 \choose 2}=3$, since we have $a_i \geq 2$ means that there are at least ${x \geq 3 \choose a_i \geq 2} \geq 3$ ways to choose which $d_i$ will be represented in our subsequence. All the combinations of the $d_i$ are valid, because we can always combine the valid substring of $A_1A_2A_3\cdots A_{i-1}$ in $X$, our choice of the $a_i$ $d_i$, and the valid substring of $A_{i+1}A_{i+2}\cdots A_n$. Hence, it is impossible for Ana to choose a valid word $W$ when Banana chooses $k=2$ subject to the conditions on $N$. Hence, Ana only wins when $a_i=1$ for at least one $i$ as described above, as desired.
20.10.2021 10:30
tastymath75025 wrote: Ana and Banana are playing a game. First Ana picks a word, which is defined to be a nonempty sequence of capital English letters. (The word does not need to be a valid English word.) Then Banana picks a nonnegative integer $k$ and challenges Ana to supply a word with exactly $k$ subsequences which are equal to Ana's word. Ana wins if she is able to supply such a word, otherwise she loses. For example, if Ana picks the word "TST", and Banana chooses $k=4$, then Ana can supply the word "TSTST" which has 4 subsequences which are equal to Ana's word. Which words can Ana pick so that she wins no matter what value of $k$ Banana chooses? (The subsequences of a string of length $n$ are the $2^n$ strings which are formed by deleting some of its characters, possibly all or none, while preserving the order of the remaining characters.) Proposed by Kevin Sun Ana wins if she picks $$A_1...............A_n$$with atleast one triple satisfying $A_{i-1} \neq A_{i } \neq A_{i+1}$ Clearly this works,to show that a word not of this form doesn't work Banana chooses $k=2$ Suppose that Ana picks $B_1...............B_x$ Call a block a substring containing all the letters same and it's length as the number of equal letters. Notice that there are $$\prod_{j=1}^k \binom{d_j+1}{d_j} \ge 3$$sub sequences where $d_i$ is the length of the block. However since $3>2$,we are done.$\blacksquare$
09.01.2022 05:27
Ana wins if and only if her word has a letter that is not adjacent to a copy of itself. If her word has such a letter, call that letter a. She can simply write the same word but repeat $a$ $k$ times. For example, if her word is TST and Banana says 9 she can say TSSSSSSSSST. We claim that there are no substrings equal to Ana's string that are not of the following form: The substring before the repeated $a$'s, one of the copies of $a$, and the substring that comes after the repeated $a$'s. Consider the substring before the repeated $a$'s. Call it $S$. The substring must include some instance of $S$. Let $l$ be the last letter of $S$. $l$ is not equal to $a$. $l$ must be included in the substring, and it must come after all of the letters before it. So, the copy of $l$ in the substring can either be $l$ or it can come after the repeated $a$'s. However, if it came after the repeated $a$'s, there would not be enough letters left after it to complete the substring. So, the substring must use $l$ as $l$. So, it must use the whole substring of $S$ that comes before the repeated $a$'s. The same logic can be applied to the substring after the repeated $a$'s. If her word does not have such a letter, we claim that it is impossible for her to make a word that has exactly 2 substrings of her original word. Let $W$ be the sequence of sequences of the same letter within Ana's word such that $W$ has the minimum possible length. So, no two consecutive elements of $W$ have same letter. For example if her word was AABBBCCAAA then $W$ would be AA, BBB, CC, AAA. Let $Q$ be any word. We will show that $Q$ does not contain exactly two substrings of Ana's word. For each element $w_k\in W$, let $f(w_k)$ be the number of letters $l$ of $Q$ such that there exists a substring of $Q$ equal to Ana's word such that $l$ is used as a letter in $w_k$. Let $g(w_k)$ represent the length of $w_k$. If $Q$ has more than one substring equal to Ana's word, there exists $w_k$ such that $f(w_k)>g(w_k)$. Then, the entire part of Ana's word before $w_k$ appears before the first letter $l$ counted by $f(w_k)$. Similarly, the entire part of Ana's word after $w_k$ appears after the last letter $l$ counted by $f(w_k)$. So, you can choose any $g(w_k)$ letters from the letters counted by $f(w_k)$ and make a substring equal to Ana's string using those. So, there are at least ${f(w_k)}\choose {g(w_k)}$ substrings equal to Ana's word. Because $g(w_k)>1$, $f(w_k)>2$. So, ${{f(w_k)}\choose {g(w_k)}}>2$. Therefore, the only words Ana can use are the words with a letter that is not adjacent to a copy of itself.
09.01.2022 21:28
Redifine a word as a sequence of letters $a_{1}a_{1}...a_{1}a_{2}a_{2}...a_{2}...a_{n}a_{n}...a_{n}$ with $a_{m}$ happening $x_{m}$ times for each $m$. Let $n$ C $k$ be $n$ choose $k$. Claim: Banana loses iff $x_m$=1 for any $m$, since Ana can just repeat the word $k$ times for the $k$ selected by Banana. Otherwise, Banana need only supply $k=2$. Proof. Banana loses iff $x_m$=1 because there are $k$ C $(k-1)$=$k$ subsequences that work in the new word, when Ana repeats $a_m$ $k$ times. To prove that there are no others, just note that for some subsequence, the block of letters repeated cannot occur before or after the $a_m$th letter being repeated, so it must occur in the $a_m$th block of letters, which implies that if $x_m=1$ for some m, then Ana can just repeat that letter k times. Now, just show that for any word where $x_m\geq2$ for all m, Banana can just supply $k=2.$ For any new word with 2 subsequences, claim that there must exist another subsequence bringing the total of this word to at least 3 subsequences. The word will be $a_{1}a_{1}...a_{1}a_{2}a_{2}...a_{2}...a_{m}a_{m}...a_{m}$ where there are $z$ $\geq2$ $a_{d}$'s for all $d$. But since $x_d\geq2$ for all $d$, this means that there are at least $z+1$ copies of some letter $a_{d}$ and then this means that there are $(z+1)Cz$ repetitions of some $a_{d}$. Since $z\geq2$, this means that there are at least $2+1=3$ repetitions. This means that Ana can never beat Banana when Banana supplies $k=2$. This proves the claim.
07.05.2022 09:57
Let the two words be $A_1,A_2,\dots,A_n$ and $B_1,B_2,\dots,B_n$. We now make the following claim: \begin{claim} If there exists $j$ such that $A_{j-1} \ne A_j$ and $A_j \ne A_{j+1}$ then Ana wins, else Banana is the winnwr. \end{claim} If such a $j$ exists, then Ana can choose the following word \[A_1A_2\ldots A_{j-1}\underbrace{A_j A_j \ldots A_j}_{k \text{ times}}A_{j+1} \dots A_n \]Clearly, we can pick $k$ working subsequences. One for each choice of $A_j$ in the under braces. Observe that we cannot have any other sub-sequences as each letter that is not in the under braces uniquely corresponds to a letter in the first word and hence cannot be removed from the sub-string. We now show that if such an $j$ doesn't exist then banana can win when $k = 2$. We will show that if there exist two sub-sequences then there is always a third sub-sequence which can be chosen. Now suppose that there are two sub-sequences \[B_{p_1} , B_{p_2} , \dots , B_{p_n}\]\[ B_{q_1} , B_{q_2} , \dots , B_{q_n}\]where $q_j$ and $p_j$ are strictly increasing sub-sequences. Let $j$ be the least positive integer such that $p_j \ne q_j$. Hence the sub-sequence can be written as follows \[B_{p_1}B_{p_2}\ldots B_{p_{j-1}} B_{p_j}B_{p_{j+1}}\dots B_{p_n}\]\[B_{p_1}B_{p_2}\dots B_{p_{j-1}} B_{q_j}B_{q_{j+1}}\ldots B_{q_n}\]Now we do casework. \emph{Case 1:} The sequences $p_{j+1},p_{j+2},\dots,p_n$ and $q_{j+1},q_{j+2},\dots,q_n$ are identical. Then we can rewrite the second sub-sequence as \[B_{p_1}B_{p_2}\ldots B_{p_{j-1}} B_{q_j}B_{p_{j+1}}\dots B_{p_n}\]Since all the $A_j$ must be equal to at least one of their adjacent letters, we get that $B_{p_j}=B_{q_j}=B_{p_{j-1}}$. Now we look at the following sub-case. \emph{Sub-Case 1:} $B_{p_j}=B_{q_j}=B_{p_{j-1}}$ Then we have the following \[B_{p_1}B_{p_2}\ldots B_{p_{j-2}} B_{\min (p_j,q_j)} B_{\max (p_j,q_j)}B_{p_{j+1}}\ldots B_{p_n}\]This works since $\max (p_j,q_j) \neq p_{j+1}$ as $p_j, q_j > p_{j-1}$ \emph{Sub-case 2:} $B_{p_j}=B_{q_j}=B_{p_{j+1}}$ Then we get the following \[B_{p_1}B_{p_2}\dots B_{p_{j-1}}B_{\min(p_j,q_j)}B_{\max (p_j,q_j)}B_{p_{j+2}}B_{p_{j+3}}\ldots B_{p_n}\]this works since $\max (p_i,q_i) \neq p_{i+1}$ as $p_j,q_j < p_{j+1}$ \emph{Case 2:} The sequences $p_{j+1},p_{j+2},\dots,p_n$ and $q_{j+1},q_{j+2},\dots,q_n$ are different. Then the sub-sequence \[B_{p_1}B_{p_2}\dots B_{p_{j-1}}B_{p_j}B_{q_{j+1}}B_{q_{j+2}}\ldots B_{q_n}\]works since it is different from the first as the sequences $p_{j+1},p_{j+2},\dots,p_n$ and $q_{j+1},q_{j+2},\dots,q_n$ are different and from the second because $p_j \ne q_j$. If $p_j > q_{j+1}$ then $q_j < p_{j+1}$. So the following sub-sequence \[B_{p_1}B_{p_2}\dots B_{p_{j-1}}B_{q_j}B_{p_{j+1}}B_{p_{j+2}}\dots B_{p_n}\]works since it differs from the first because $q_j \ne p_j$ and from the second because the sequences $p_{j+1},p_{j+2},\ldots,p_n$ and $q_{j+1},q_{j+2},\ldots,q_n$ are different. Combining all these results we see that Banana can win with $\boxed{k=2}$. If Ana picked a word such that for every $j$, we either have $A_{j-1} = A_j$ or $A_j = A_{j+1}$, which is the desired result. $\square$
17.07.2022 09:52
I see everyone's proof and is much longer than mine. I actually didn't read it because I don't want to reveal the solution. Can someone check my work and see if it is correct? (mine is much shorter than the one above).
18.07.2022 19:27
coolmath_2018 wrote: I see everyone's proof and is much longer than mine. I actually didn't read it because I don't want to reveal the solution. Can someone check my work and see if it is correct? (mine is much shorter than the one above).
I don't think this is correct. The duplicate letters don't need to be $L_2$ and $L_3.$ @below Well, if you have a word like $L_1 L_2 L_3 (L_4 = L_5) \cdots L_n,$ where $(L_4, L_5)$ is the only pair of adjacent characters that are the same, you need to show that this is also a losing word for Ana, but your proof doesn't show it for such a word. Also, just because a particular strategy doesn't work for a word doesn't necessarily mean that there isn't another strategy that does. I think you might be mixing up the two parts of the proof: If a strategy works on a word, then that word is winning; this is correct. However, if that strategy doesn't work on a word, we can't conclude only from that that the word is losing. edit: ignore this is wrong
20.07.2022 09:07
MelonGirl wrote: coolmath_2018 wrote: I see everyone's proof and is much longer than mine. I actually didn't read it because I don't want to reveal the solution. Can someone check my work and see if it is correct? (mine is much shorter than the one above).
I don't think this is correct. The duplicate letters don't need to be $L_2$ and $L_3.$ Why does it matter if it is something different than $L_2$ and $L_3$? Aren't they all the same. Can you give me a hint to guide me toward the right direction? Thanks
22.07.2022 07:48
My solution is very funny because it suffices to just consider $K=2$ for the losing words haha >_< All winning words for Ana contain some letter which is not equal to any of its neighbor(s). Say the word is $A = s_1 s_2 \ldots s_n$ where for some index $i,$ $s_{i-1} \neq s_i \neq s_{i+1}.$ Then given $k,$ Ana can choose the word $s_1 \ldots s_{i-1} (s_i s_i \ldots s_i) s_{i+1} \ldots s_n$ where $s_i$ is repeated $K$ times. This clearly contains the subsequence $A$ exactly $K$ times. Suppose now that each letter in $A$ is equal to at least one of its neighbors. We can construct Ana's second word $A'$ by inserting letters into the spaces between $A,$ since $A$ itself must be a subsequence of $A'.$ Specifically, let location $j$ ($0\leq j \leq n$) denote the space between letters $s_j$ and $s_{j+1}$ in $A.$ Since each letter in $A$ is equal to a neighbor, $A$ can be written in block form $B_1 B_2 \ldots B_m$ where each $B_i = b_i b_i \ldots b_i$ for some $b_i$ where $b_{i-1} \neq b_i \neq b_{i+1}, |B_i| \geq 2$ and $\sum_{i=1}^{m} |B_i| = n.$ But now consider $k=2.$ Notice that if we insert an additional $b_i$ into any location $l$ in the range $\sum_{j \leq i-1} |B_i| \leq l \leq \sum_{j \leq i} |B_i|$ as then we could form $\binom{|B_i| + 1}{|B_i|} = |B_i| + 1 > 2$ distinct subsequences of $A$ in $A',$ by choosing $|B_i|$ of those $|B_i|+1$ $b_i$'s and the rest of the letters we pick the same from $A.$ So we cannot insert any letter $b_i$'s into these locations. Suppose the original subsequence of $A$ in $A'$ is denoted by $S.$ Since $K=2,$ let $S'$ be the other subsequence of $A$ in $A'.$ Consider the first block $B_k$ such that $S'$ does not coincide with $S.$ ie for each $B_j, j \leq k-1,$ the positions in $A$ that form $B_j$ in $S$ in $S'$ are the same. But this means we need to insert an additional letter $b_k$ into some location $l.$ By assumption, it cannot be in locations $\sum_{j \leq k-1} \leq l \leq \sum_{j\leq i} |B_i|.$ But also since $S'$ coincides with $S$ on all previous blocks, we also cannot have $l \leq \sum_{j \leq k-1} |B_j|$ Thus it must be that $l \geq \sum_{j \leq k} |B_i| + 1.$ But this means that that this newly inserted $b_k$ appears after the first $b_{k+1}$ in the block $B_{k+1}$ of $S.$ However then we must additionally insert a $b_{k+1}$ as well (because $S'$ cannot coincide with $S$ on $B_{k+1}$ since they can share at most $|B_{k+1}| - 1$ of the $b_{k+1}$'s), and this $b_{k+1}$ cannot be in any locations $l < \sum_{j \leq k} |B_j|$ since it comes after the $b_k$ we previously inserted, and also by assumption it can't be in any locations $\sum_{j \leq k} |B_j| \leq l \leq \sum_{j \leq k+1} |B_j|.$ Thus we must insert this $b_{k+1}$ into some location $l \geq \sum_{j \leq k+1} |B_i| + 1.$ Repeating this argument, we eventually get that we must insert some letter $b_m$ for the final block $B_m$ of $S'$ in a location $l \geq \sum_{j \leq m} |B_j| + 1 = n+1,$ which is impossible. $\blacksquare$
26.07.2022 18:04
Rewrite Ana's original word as\[S=\underbrace{a_1 \cdots a_1}_{b_1 \text{ times }} \underbrace{a_2 \cdots a_2}_{b_2 \text{ times }} \cdots \underbrace{a_n\cdots a_n}_{b_n \text{ times }}\]Let $S_i=a_i\cdots a_i$, so $S=S_1S_2\cdots S_n$. Call the number of letters in $S_i$ as $b_i$. Ana can win if and only if $b_i=1$ for some $i$. Proof of sufficiency: We will show that Ana can win if $b_x=1$ for some $1\le x\le n$. After Banana chooses $k$, then Ana will choose the word\[A=S_1S_2\cdots S_{x-1} \underbrace{a_x\cdots a_x}_{k \text{ times }}S_{x+1}\cdots S_n\]Define $T_x=\underbrace{a_x\cdots a_x}_{k\text{ times }}$. So\[A=S_1S_2\cdots S_{x-1}T_x S_{x+1}\cdots S_n\]Consider a subsequence of $A$ that is equal to $S$. The single $a_x$ letter is to the right of at least the number of letters in $S_1S_2\cdots S_{x-1}$ and to the left of at least the number of letters in $S_{x+1}S_{x+2}\cdots S_n$. Thus, this single $a_x$ letter is in $T_x$. This implies that nothing else in $T_x$ is in the subsequence. Thus, after we place $a_x$, everything else is uniquely defined. There are $k$ ways to place $a_x$, since $T_x$ has $k$ letters. So there are at most $k$ subsequences of $A$ that are equal to $S$. The subseqeunce $S_1S_2\cdots S_{x-1} a_x S_{x+1}\cdots S_n$ works for any $a_x\in T_x$, which implies that there are indeed exactly $k$ such subsequences. $\square$ Proof of necessity: Then $b_1, b_2, \ldots, b_n>1$. We will show that if Banana chooses $k=2$, then Ana cannot win. Suppose FTSOC some word $W $ has exactly $2$ subsequences equal to $S$. Call those subsequences $T_1$ and $T_2$. Note that there exists a block $S_m$ of $S$ for which the locations of $S_m$ in $W$ differ for $T_1$ and $T_2$. Let\[W=W_1W_2\ldots W_k\]Suppose the block $S_m$ in $T_1$ occupies\[W_{x_1}, W_{x_2}, W_{x_3}, \ldots W_{x_{b_m}}\]and the block $S_m$ in $T_2$ occupies\[W_{y_1}, W_{y_2}, W_{y_3}, \ldots W_{y_{b_m}}\]where $x_1<x_2<\cdots< x_{b_m}$ and $y_1<y_2<\cdots < y_{b_m}$. Let $i$ be a positive integer for which $x_i\ne y_i$ (must exist as the subsequences are different). WLOG $x_i>y_i$. Consider the subsequence\[S_1S_2 \ldots S_{m-1} W_{y_1} W_{y_2} \cdots W_{y_i} W_{x_{i+1}} W_{x_{i+2}} \cdots W_{x_{b_m}}S_{m+1} S_{m+2 }\cdots S_n\]where $S_1 S_2 \cdots S_{m-1} $ are defined by their positions in $T_2$ and $S_{m+1} S_{m+2} \cdots S_n$ are defined by their positions in $T_1$. Since $b_m>1$, this subsequence is different from $T_1$ and $T_2$ $\square$.
07.01.2023 07:27
Let the "Ana-word" be Ana's chosen word. Let a "block" be a run of consecutive identical letters in the Ana-word, and let the sequence of values $b_i$ for $i=1,2,\dots,n$ be the length of the $i$-th block, where there are $n$ blocks in the Ana-word in total. Let $L_i$ be the letter of the $i$-th block in the Ana-word. So Ana's word can be represented by \[\underbrace{L_1\dots L_1}_{b_1}\underbrace{L_2\dots L_2}_{b_2}\dots \underbrace{L_{n}\dots L_{n}}_{b_{n}}.\] If there exists an $m\in \{1,2,\dots,n\}$ such that $b_n=1$, then Ana always wins, since she can just respond with the word \[\underbrace{L_1\dots L_1}_{b_1}\dots \underbrace{L_{m-1}\dots L_{m-1}}_{b_{m-1}} \underbrace{L_m \dots L_m}_k \underbrace{L_{m+1}\dots L_{m+1}}_{b_{m+1}}\dots\underbrace{L_{n}\dots L_{n}}_{b_{n}}.\]Here, there are $k$ choices for $L_m$, and exactly one choice for all the other letters. Suppose that $b_i\geq 2$ for all $i\in \{1,2,\dots,n\}$, and suppose for the sake of contradiction that Ana can win when Banana chooses $k=2$. Then the Ana-word must be present in the word $\Omega$ that she responds with. Take the (or one of the) Ana-word $W_1$ in $\Omega$ with the first letter as far to the right as possible. If there is at least $1$ of $L_1$ to the left of $W_1$, then there are at least $\tbinom{b_1+1}{b_1}=b_1+1$ Ana-words in $\Omega$ (because this is the number of ways we can choose the first block of the Ana-word while keeping the rest of $W_1$), which is a contradiction since we assumed $b_1\geq 2$. So there are no $L_1$ to the left of $W_1$. Hence there is exactly one possibility for the first block of all the Ana-words in $\Omega$, and it is the one in $W_1$. Now assume that there is exactly one possibility for what each of the blocks with indices $1,\dots,r-1$ could be, where $r-1\geq 1$. The case $r-1=1$ is our base case for our induction. We proceed in the same way as we did in the base case. For the block $r$, we again take the Ana-word $W_r$ such that the first letter, $\alpha$, of the $r$-th block is as far to the right as possible. If there is at least $1$ of $L_r$ to the left of $\alpha$, then there are at least $\tbinom{b_r+1}{b_r}=b_r+1$ Ana-words in $\Omega$, contradiction since $b_r\geq 2$. Hence there are no $L_r$ in $\Omega$ that are both to the left of $\alpha$, and to the right of the blocks in $W_r$ with index less than $r$. So there is exactly one possibility for the $r$-th block, and our induction is complete. We conclude that Ana loses when $k=2$ if every block in the Ana-word has length of at least $2$, and she can win for any $k$ if there exists a block in the Ana-word with length $1$.
21.02.2023 22:49
Beautiful Let Ana's first and second words be $Income$ and $Outcome$. We'll divide the $Income$ into blocks of same letters such that each two consecutive blocks contain different letters for example $AAABBCDDCC$ will turn into $AAA - BB - C - DD - CC$. We say an $Income$ is $Unicorn$ if there exists a block of length $1$ in it. Claim $:$ Ana wins iff $Income$ is $Unicorn$. Proof $:$ First we'll prove if $Income$ is $Unicorn$ then Ana can win. Assume $Income$ is $Blah Blah Blah - U - Blah Blah Blah$ where $U$ is the block of length $1$ and $Blah Blah Blah$ contains other blocks. If Banana chooses $k$, then Ana will make the $Outcome$ to be $Blah Blah Blah - U...U - Blah Blah Blah$ where $U...U$ has the length of $k$. It clearly works. Now we'll prove if $Income$ is not $Unicorn$ then Ana can't win. We'll prove it using induction on the number of blocks of $Income$. As for the base assume $Income$ is $U...U$ which has the length of $t$.Now if Banana chooses $k = 2$ then $Outcome$ most contain at least $t+1$ of $U$'s. but $\tbinom{t+1}{t}=t+1$ which is greater than $2$ so Ana failed. Now Assume $Income$ has $n$ blocks. Assume $Income$'s first block is $U...U$ with the length of $t$. Note that Obviously any block like $X...X$ witch appears in $Outcome$ before the $t$-th $U$ is useless so we may Assume $Outcome$'s first block is $U...U$ with length of at least $t$. We have $2$ cases for $Outcome :$ $1 - U..U$'s length in $Outcome$ is exactly $t$. Then there's only $1$ way to choose the first block so for getting contradiction there has to be exactly $2$ choices for the rest of the block, which is impossible by induction hypothesis so Ana failed. $2 - U...U$'s length in $Outcome$ is more than $t$. Then there's at least $\tbinom{t+1}{t}=t+1$ ways to choose first block but since $Income$ is not $Unicorn$ then $t > 1$ so $t+1 > 2$ so again number of subsequences is more than $2$ which means Ana failed. So Ana can pick $Unicorn$ words and will win no matter the value of $k$ and if picks $non - Unicorn$ words will surely lose.
16.07.2023 04:56
Consider Ana's word as: \[\underbrace{a_1\dots a_1}_{k_1}\underbrace{a_2\dots a_2}_{k_2}\dots \underbrace{a_n\dots a_n}_{k_n}.\]We now make the following claim: $\underline{Claim:} $ Ana wins if and only if at least one $k_i=1$, $1\leq i\leq n$. $\underline{Proof:}$ We first prove that Ana wins if at least one $k_i=1$, $1\leq i\leq n$. Fix $i=j$, so $k_j=1$. The word that Ana can supply is: \[\underbrace{a_1\dots a_1}_{k_1}\underbrace{a_2\dots a_2}_{k_2}\dots \underbrace{a_i\dots a_i}_{k}\dots \underbrace{a_n\dots a_n}_{k_n}.\]This results in $k$ possible choices for $a_i$ and one choice for everything else in the original sequence. This means that the above word has $k$ sub-sequences that are Ana's original word. Now, we prove the contra-positive, or if all $b_i\geq 2$, $1\leq i\leq n$, Ana will lose. If $k=1,$ the supplied word is the original word. If $k\geq 2,$ we must add at least one of $a_1,\dots ,a_n$ to the original word to get the supplied word. Let us say we add $a_i$. This means there must be at least: \[\binom{b_i+1}{b_i},\]sub-sequences of the original word, in the supplied word. As $b_i\geq 2:$ \begin{align*} \binom{b_i+1}{b_i}&\geq \binom{3}{2}\\ &=3.\\ \end{align*}Therefore, it is impossible to have have $k=2$ sub-sequences, meaning that Ana will lose if $k=2$.
02.08.2023 16:48
The answer is $\boxed{\text{all words with a length-1 block}}$, where a block is a contiguous, locally maximal, and uniform subsequence of a word. For example, the blocks of "ABBAAA" are "A", "BB", and "AAA", but not "AA" or "AAAA". Proof of necessity. We claim that for any word without a length-$1$ block, Ana loses when $k=2$. Indeed, suppose for the sake of contradiction that the word Ana supplies contains exactly two distinct subsequences equal to Ana's word with blocks $a_1,\dots,a_n$ and $b_1,\dots,b_n$, where for each $1\le i\le n$, $a_i=b_i$ up to position. Specifically, let $a_1=b_1$ comprise $m\ge2$ "A"s. If $a_1$ and $b_1$ are in distinct positions, say with $a_1$ before $b_1$, we can combine "A"s from both $a_1$ and $b_1$ to produce a new block $c_1$ of $m$ "A"s, where $c_1\neq a_1,b_1$ precisely since $m\ge2$. Then $c_1, b_2,\dots,b_n$ is a new subsequence equal to Ana's word, contradiction; it follows that $a_1=b_1$. But repeating the above argument yields $a_2=b_2$, $a_3=b_3$, and so on up to $a_n=b_n$, contradicting distinctness. Proof of sufficiency. If Ana's word contains a length-$1$ block, say "A", she can supply the same word except with the single "A" replaced by $k$ contiguous "A"s, for whatever $k$ Banana chooses. Accordingly, any subsequence equal to Ana's word is determined up to the "A", which can be chosen in $k$ ways as desired. $\square$
21.06.2024 05:45
Ana wins if and only if there exists a letter in string \( A \) which is different from all its neighbors. $\boxed{\text{If Direction Ana Wins:}}$ Suppose there exists a letter \( a \) in \( A \) such that it is different from its neighbors. Let \( A = s_1as_2 \), where \( s_1 \) and \( s_2 \) are possibly empty sequences. Ana can choose \( B = s_1 \underbrace{aa \ldots a}_k s_2 \) to win, where \( k \) is the number of occurrences of \( a \) in \( A \). Any subsequence of \( B \) that matches \( A \) must take \( s_1 \) and \( s_2 \) intact and select one of the \( k \) occurrences of \( a \) in the middle. Thus, there are exactly \( k \) subsequences of \( B \) that match \( A \). $\boxed{\text{Only If Direction(Ana Does Not Win)::}}$ Assume every letter in \( A \) is the same as at least one of its neighbors. We aim to show that Ana cannot win under this condition. Suppose for a contradiction that there exists a string \( B \) such that exactly 2 subsequences of \( B \) match \( A \). Let \( X \) and \( Y \) be these two distinct subsequences of \( B \) that match \( A \). There exists a position \( j \) where \( X \) and \( Y \) differ, and from position \( j+1 \) onward, they are identical. Construct a new string \( S \) by taking the beginning of \( X \) up to \( j \), and then appending the last letter of \( Y \). \( S \) is a valid subsequence of \( B \) and is different from both \( X \) and \( Y \), contradicting the assumption that there are only 2 subsequences of \( B \) that match \( A \). Therefore, Ana can win if and only if there exists at least one letter in \( A \) that is different from all its neighbors.