QOJ.ac

QOJ

Süre Sınırı: 2 s Bellek Sınırı: 1024 MB

#23924. JOI Editor

İstatistikler

問題文

ただ奇妙な発明で知られる JOI 社は,最近 JOI Editor というテキストエディタを開発した.

このテキストエディタは,j,o,i の 3 つのキーで操作することができる.j,o,i のいずれかのキーを押すと,そのキーに書かれている英小文字が入力されるが,同じ英小文字が 2 つ隣接すると,ただちにその 2 文字が対応する英大文字に置換される.すなわち,jj は JJ に,oo は OO に,ii は II に置換される.

例えば,j,o,o,o,i のキーをこの順番で押すと,j,o,o までキーを押した直後,2 文字目と 3 文字目の並びが oo となる.同じ英小文字が 2 つ隣接しているので,この 2 文字がただちに OO に置換される.最終的に JOI Editor に書かれている文字列は jOOoi となる.joOOi や jOOOi とはならないことに注意せよ.

長さ N の文字列 S が与えられる.S の各文字は j,o,i のいずれかである.

N 回キーを押す.S の i 文字目 (1 ≦ i ≦ N) は i 回目に押すキーを表す.最終的に JOI Editor に書かれている文字列を出力せよ.

制約

  • 1 ≦ N ≦ 100.
  • S は長さ N の文字列である.
  • S の各文字は j,o,i のいずれかである.
  • N は整数である.

入力

入力は以下の形式で与えられる.
N
S

出力

最終的に JOI Editor に書かれている文字列を出力せよ.


入力例 1

6
jjoiii

出力例 1

JJoIIi
  • 1 回目に押すキーは j のキーである.JOI Editor に書かれている文字列は j となる.
  • 2 回目に押すキーは j のキーである.JOI Editor に書かれている文字列は jj となる.
    • 同じ英小文字が隣接しているので,jj が JJ に置換され,JOI Editor に書かれている文字列は JJ となる.
  • 3 回目に押すキーは o のキーである.JOI Editor に書かれている文字列は JJo となる.
  • 4 回目に押すキーは i のキーである.JOI Editor に書かれている文字列は JJoi となる.
  • 5 回目に押すキーは i のキーである.JOI Editor に書かれている文字列は JJoii となる.
    • 同じ英小文字が隣接しているので,ii が II に置換され,JOI Editor に書かれている文字列は JJoII となる.
  • 6 回目に押すキーは i のキーである.JOI Editor に書かれている文字列は JJoIIi となる.

最終的に JOI Editor に書かれている文字列は JJoIIi であるので,JJoIIi を出力する.


入力例 2

6
joijoi

出力例 2

joijoi
  • この例では置換は行われない.最終的に JOI Editor に書かれている文字列は joijoi であるので,joijoi を出力する.

入力例 3

7
ooooooo

出力例 3

OOOOOOo

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.