{"problem":{"name":"Longest Y","description":{"content":"Given is a string $S$ consisting of `Y` and `.`. You can do the following operation on $S$ between $0$ and $K$ times (inclusive). *   Swap two adjacent characters in $S$. What is the maximum possibl","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc229_g"},"statements":[{"statement_type":"Markdown","content":"Given is a string $S$ consisting of `Y` and `.`.\nYou can do the following operation on $S$ between $0$ and $K$ times (inclusive).\n\n*   Swap two adjacent characters in $S$.\n\nWhat is the maximum possible number of consecutive `Y`s in $S$ after the operations?\n\n## Constraints\n\n*   $2 \\leq |S| \\leq 2 \\times 10^5$\n*   Each character of $S$ is `Y` or `.`.\n*   $0 \\leq K \\leq 10^{12}$\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":"abc229_g","tags":[],"sample_group":[["YY...Y.Y.Y.\n2","3\n\nAfter swapping the $6$\\-th, $7$\\-th characters, and $9$\\-th, $10$\\-th characters, we have `YY....YYY..`, which has three consecutive `Y`s at $7$\\-th through $9$\\-th positions.  \nWe cannot have four or more consecutive `Y`s, so the answer is $3$."],["YYYY....YYY\n3","4"]],"created_at":"2026-03-03 11:01:14"}}