{"problem":{"name":"ABCBAC","description":{"content":"For a string $S$ of length $N$ and an integer $i\\ (0\\leq i\\leq N)$, let us define the string $f_i(S)$ as the concatenation of: *   the first $i$ characters of $S$, *   the reversal of $S$, and *   th","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc284_f"},"statements":[{"statement_type":"Markdown","content":"For a string $S$ of length $N$ and an integer $i\\ (0\\leq i\\leq N)$, let us define the string $f_i(S)$ as the concatenation of:\n\n*   the first $i$ characters of $S$,\n*   the reversal of $S$, and\n*   the last $(N-i)$ characters of $S$,\n\nin this order. For instance, if $S=$ `abc` and $i=2$, we have $f_i(S)=$ `abcbac`.\nYou are given a string $T$ of length $2N$. Find a pair of a string $S$ of length $N$ and an integer $i\\ (0\\leq i\\leq N)$ such that $f_i(S)=T$. If no such pair of $S$ and $i$ exists, report that fact.\n\n## Constraints\n\n*   $1\\leq N \\leq 10^6$\n*   $N$ is an integer.\n*   $T$ is a string of length $2N$ consisting of lowercase English letters.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ \n$T$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc284_f","tags":[],"sample_group":[["3\nabcbac","abc\n2\n\nAs mentioned in the problem statement, if $S=$ `abc` and $i=2$, we have $f_i(S)=$ `abcbac`, which equals $T$, so you should print `abc` and $2$."],["4\nabababab","abab\n1\n\n$S=$ `abab` and $i=3$ also satisfy the condition."],["3\nagccga","cga\n0\n\n$S=$ `agc` and $i=3$ also satisfy the condition."],["4\natcodeer","\\-1\n\nIf no pair of $S$ and $i$ satisfies the condition, print `-1`."]],"created_at":"2026-03-03 11:01:13"}}