Bobo is studying encoding to send messages to his best friend, oboB. He recently developed a “Boboencoding," which is essentially a binary encoding. However, unlike direct binary encoding,“Bobo encodingconsists of three parts: a “start recognition string" t at the beginning, a “message string" s used to transmitinformation, and an “end recognition string" t that is identical to the “start recognition string." Given a'message string" s that needs to be transmitted and a recognition string t, the Bobo encoding of thismessage string" s is t + s + t, where + indicates string concatenation. When sending information, Boboencrypts the message string he wants to transmit into “Bobo encoding" and transmits it to oboB one by oneoboB will stop receiving information as soon as he finds the recognition string appearing twice in thereceived string, indicating that he has received both the “start recognition string" and the "end recognitionstring." Note that the recognition string can overlap, for example, if the recognition string is t = 101 andoboB receives 10101, oboB will think that the recognition string has appeared twice, and stop receivinginformation.
Bobo is quite proud of his “Bobo encoding," but he has no idea that he has made a huge mistake! One dayBobo wanted to send the message string 1101 to oboB, and they agreed that the recognition string was010. So the “Bobo encoding" of this message string is 010 + 1101 - 010 = 0101101010. However.oboB found that he had received two recoanition strinas 010 after receiving the first characters 01011010so he mistakenly took 01011010 as the“Bobo encoding.
Nevertheless, Bobo thinks there must be some way to fix this issue. He wants to know if, given a patternstring t and the lenath n of the message string to be sent, he can find a suitable message string so that the“Bobo encoding”can be correctly interpreted.
Formally, given a string t consisting only of 0s and 1s, and a positive integer n, can you find a string sconsisting only of 0s and 1s with a length of n so that t appears only twice in t + s + t (only at the beginning and the end)?