{"problem":{"name":"Connection and Disconnection","description":{"content":"Given is a string $S$. Let $T$ be the concatenation of $K$ copies of $S$. We can repeatedly perform the following operation: choose a character in $T$ and replace it with a different character. Find t","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"agc039_a"},"statements":[{"statement_type":"Markdown","content":"Given is a string $S$. Let $T$ be the concatenation of $K$ copies of $S$. We can repeatedly perform the following operation: choose a character in $T$ and replace it with a different character. Find the minimum number of operations required to satisfy the following condition: any two adjacent characters in $T$ are different.\n\n## Constraints\n\n*   $1 \\leq |S| \\leq 100$\n*   $S$ consists of lowercase English letters.\n*   $1 \\leq K \\leq 10^9$\n*   $K$ is an integer.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$S$\n$K$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"agc039_a","tags":[],"sample_group":[["issii\n2","4\n\n$T$ is `issiiissii`. For example, we can rewrite it into `ispiqisyhi`, and now any two adjacent characters are different."],["qq\n81","81"],["cooooooooonteeeeeeeeeest\n999993333","8999939997"]],"created_at":"2026-03-03 11:01:14"}}