{"raw_statement":[{"iden":"statement","content":"One of the most useful tools nowadays are text editors, their use is so important that the Unique Natural Advanced Language (UNAL) organization has studied many of the benefits working with them. \n\nThey are interested specifically in the feature \"find\", that option looks when a pattern occurs in a text, furthermore, it counts the number of times the pattern occurs in a text. The tool is so well designed that while writing each character of the pattern it updates the number of times that the corresponding prefix of the total pattern appears on the text.\n\nNow the UNAL is working with the editor, finding patterns in some texts, however, they realize that many of the patterns appear just very few times in the corresponding texts, as they really want to see more number of appearances of the patterns in the texts, they put a lower bound on the minimum number of times the pattern should be found in the text and use only prefixes of the original pattern. On the other hand, the UNAL is very picky about language, so they will just use the largest non-empty prefix of the original pattern that fit into the bound.\n\nThe first line contains the text A (1 ≤ |A| ≤  105) The second line contains the original pattern B (1 ≤ |B| ≤  |A|) The third line contains an integer n (1 ≤ n ≤  |A|) - the minimum number of times a pattern should be found on the text.\n\nA single line, with the prefix of the original pattern used by the UNAL, if there is no such prefix then print \"IMPOSSIBLE\" (without the quotes)\n\n"},{"iden":"input","content":"The first line contains the text A (1 ≤ |A| ≤  105) The second line contains the original pattern B (1 ≤ |B| ≤  |A|) The third line contains an integer n (1 ≤ n ≤  |A|) - the minimum number of times a pattern should be found on the text."},{"iden":"output","content":"A single line, with the prefix of the original pattern used by the UNAL, if there is no such prefix then print \"IMPOSSIBLE\" (without the quotes)"},{"iden":"examples","content":"Inputaaaaaaaa4OutputaaInputprogrammingunal1OutputIMPOSSIBLEInputabracadabraabra1OutputabraInputHello World!H W5OutputIMPOSSIBLE"}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ A \\in \\Sigma^* $ be the text string.  \nLet $ B \\in \\Sigma^* $ be the original pattern string, with $ |B| \\leq |A| $.  \nLet $ n \\in \\mathbb{Z}^+ $ be the minimum required occurrence bound.  \n\nFor each $ k \\in \\{1, 2, \\dots, |B|\\} $, define $ B_k $ as the prefix of $ B $ of length $ k $:  \n$$ B_k = B[1..k] $$  \n\nLet $ f(k) $ denote the number of occurrences of $ B_k $ as a substring in $ A $.  \n\n**Constraints**  \n1. $ 1 \\leq |A| \\leq 10^5 $  \n2. $ 1 \\leq |B| \\leq |A| $  \n3. $ 1 \\leq n \\leq |A| $  \n\n**Objective**  \nFind the largest $ k \\in \\{1, 2, \\dots, |B|\\} $ such that $ f(k) \\geq n $.  \nIf such a $ k $ exists, output $ B_k $.  \nOtherwise, output \"IMPOSSIBLE\".","simple_statement":"Given a text A, a pattern B, and a minimum count n, find the longest prefix of B that appears at least n times in A. If none exists, print \"IMPOSSIBLE\".","has_page_source":false}