B - Cat Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 200200

問題文

長さ NN の文字列 SS が与えられます。

SS に連続して含まれる na を全て nya に置き換えて得られる文字列を答えてください。

制約

  • NN11 以上 10001000 以下の整数
  • SS は英小文字からなる長さ NN の文字列

入力

入力は以下の形式で標準入力から与えられる。

NN
SS

出力

答えを出力せよ。


入力例 1Copy

Copy
4
naan

出力例 1Copy

Copy
nyaan

naan に連続して含まれる na を全て nya に置き換えて得られる文字列は nyaan です。


入力例 2Copy

Copy
4
near

出力例 2Copy

Copy
near

SSna が連続して含まれないこともあります。


入力例 3Copy

Copy
8
national

出力例 3Copy

Copy
nyationyal

Score : 200200 points

Problem Statement

You are given a string SS of length NN.

Find the string obtained by replacing all contiguous occurrences of na in SS with nya.

Constraints

  • NN is an integer between 11 and 10001000, inclusive.
  • SS is a string of length NN consisting of lowercase English letters.

Input

The input is given from Standard Input in the following format:

NN
SS

Output

Print the answer.


Sample Input 1Copy

Copy
4
naan

Sample Output 1Copy

Copy
nyaan

Replacing all contiguous occurrences of na in naan with nya results in the string nyaan.


Sample Input 2Copy

Copy
4
near

Sample Output 2Copy

Copy
near

SS may not contain a contiguous na.


Sample Input 3Copy

Copy
8
national

Sample Output 3Copy

Copy
nyationyal


2025-04-14 (Mon)
13:37:01 +00:00