{"problem":{"name":"One Time Swap","description":{"content":"You are given a string $S$. Find the number of strings that can result from performing the following operation **exactly once**. *   Let $N$ be the length of $S$. Choose a pair of integers $(i,j)$ su","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc345_c"},"statements":[{"statement_type":"Markdown","content":"You are given a string $S$. Find the number of strings that can result from performing the following operation **exactly once**.\n\n*   Let $N$ be the length of $S$. Choose a pair of integers $(i,j)$ such that $1\\leq i<j\\leq N$ and swap the $i$\\-th and $j$\\-th characters of $S$.\n\nIt can be proved that you can always perform it under the constraints of this problem.\n\n## Constraints\n\n*   $S$ is a string of length between $2$ and $10^6$, inclusive, consisting of lowercase English letters.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$S$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc345_c","tags":[],"sample_group":[["abc","3\n\nThe length of $S$ is $3$, so $1\\leq i<j\\leq 3$ is satisfied by three pairs of integers $(i,j)$: $(1,2)$, $(1,3)$, and $(2,3)$.\n\n*   Swapping the $1$\\-st and $2$\\-nd characters of $S$ results in $S$ being `bac`.\n*   Swapping the $1$\\-st and $3$\\-rd characters of $S$ results in $S$ being `cba`.\n*   Swapping the $2$\\-nd and $3$\\-rd characters of $S$ results in $S$ being `acb`.\n\nTherefore, the operation on `abc` results in one of the three strings: `bac`, `cba`, and `acb`, so print $3$."],["aaaaa","1\n\nSwapping any two characters results in $S$ remaining `aaaaa`. Thus, only one string can result from the operation."]],"created_at":"2026-03-03 11:01:14"}}