Cat

AtCoder
IDabc286_b
Time2000ms
Memory256MB
Difficulty
You are given a string $S$ of length $N$. Find the string obtained by replacing all contiguous occurrences of `na` in $S$ with `nya`. ## Constraints * $N$ is an integer between $1$ and $1000$, inclusive. * $S$ is a string of length $N$ consisting of lowercase English letters. ## Input The input is given from Standard Input in the following format: $N$ $S$ [samples]
Samples
Input #1
4
naan
Output #1
nyaan

Replacing all contiguous occurrences of `na` in `naan` with `nya` results in the string `nyaan`.
Input #2
4
near
Output #2
near

$S$ may not contain a contiguous `na`.
Input #3
8
national
Output #3
nyationyal
API Response (JSON)
{
  "problem": {
    "name": "Cat",
    "description": {
      "content": "You are given a string $S$ of length $N$. Find the string obtained by replacing all contiguous occurrences of `na` in $S$ with `nya`.",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc286_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given a string $S$ of length $N$.\nFind the string obtained by replacing all contiguous occurrences of `na` in $S$ with `nya`.\n\n## Constraints\n\n*   $N$ is an integer between $1$ and $1000$, inc...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments