303768: CF729A. Interview with Oleg

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Interview with Oleg

题意翻译

给定一个长度为n的字符串s 将s中所有以"ogo"开头,后接任意个"go"的子串替换为"***" 输出替换之后的s

题目描述

Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string $ s $ consisting of $ n $ lowercase English letters. There is a filler word ogo in Oleg's speech. All words that can be obtained from ogo by adding go several times to the end of it are also considered to be fillers. For example, the words ogo, ogogo, ogogogo are fillers, but the words go, og, ogog, ogogog and oggo are not fillers. The fillers have maximal size, for example, for ogogoo speech we can't consider ogo a filler and goo as a normal phrase. We should consider ogogo as a filler here. To print the interview, Polycarp has to replace each of the fillers with three asterisks. Note that a filler word is replaced with exactly three asterisks regardless of its length. Polycarp has dealt with this problem in no time. Can you do the same? The clock is ticking!

输入输出格式

输入格式


The first line contains a positive integer $ n $ ( $ 1<=n<=100 $ ) — the length of the interview. The second line contains the string $ s $ of length $ n $ , consisting of lowercase English letters.

输出格式


Print the interview text after the replacement of each of the fillers with "\*\*\*". It is allowed for the substring "\*\*\*" to have several consecutive occurences.

输入输出样例

输入样例 #1

7
aogogob

输出样例 #1

a***b

输入样例 #2

13
ogogmgogogogo

输出样例 #2

***gmg***

输入样例 #3

9
ogoogoogo

输出样例 #3

*********

说明

The first sample contains one filler word ogogo, so the interview for printing is "a\*\*\*b". The second sample contains two fillers ogo and ogogogo. Thus, the interview is transformed to "\*\*\*gmg\*\*\*".

Input

题意翻译

给定一个长度为n的字符串s 将s中所有以"ogo"开头,后接任意个"go"的子串替换为"***" 输出替换之后的s

加入题单

算法标签: