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.

NoteThe 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***".

Program ff;
var s, p:string; i, j, n:integer;
begin
readln(n);
readln(s);
i:=1;
while i<=length(s)-2 do
begin
j:=i;
if s[i]+s[i+1]+s[i+2]='ogo' then
 begin
  s[i]:='*'; s[i+1]:='*'; s[i+2]:='*';
   while (j+4<=length(s))and(s[j+3]+s[j+4]='go') do
    begin
     delete(s, j+3, 2);
    end;
 end;
i:=i+1;
end;

writeln(s);
end.

var
  n,i,x,r,j:longint;
  s:string;
begin
  readln(n);
  readln(s);
  x:=pos('ogo',s);
  while x<>0 do begin
    s[x]:='*';
    s[x+1]:='*';
    s[x+2]:='*';
    i:=x+3;
    r:=(n-i+1) div 2;
    for j:=1 to r do if s[i]+s[i+1]='go' then delete(s,i,2);
    n:=length(s);
    x:=pos('ogo',s);
  end;
  write(s)
end.

var
s:string;
n,a,b:longint;
begin
readln(n);
readln(s);
n:=length(s);
while n > 0 do
begin
a:=pos('ogo',s);
b:=pos('*go',s);
if (a > 0) or (b > 0) then begin
b:=pos('*go',s);
if b > 0 then begin delete(s,b+1,2); n:=n-2; end;
a:=pos('ogo',s);
if (a > 0) then begin n:=n-3;
delete(s,a,3);
insert('***',s,a);
end;
end
else n:=n-1;
end;
a:=1;
while a <> 0 do begin
a:=pos('***g***',s);
if a > 0 then delete(s,a,4); end;
writeln(s);
end.

var
  s : ansistring;
  f : array[0..1500] of longint;
  n,i,j,l : longint;

begin
  readln(n);
  readln(s);
  i:=1;
  while i <= n-2 do begin
    if s[i]+s[i+1]+s[i+2] = 'ogo' then begin
      l:=i;
      i:=i+3;
      while (i <= n-1) do if s[i]+s[i+1] = 'go' then i:=i+2 else break;
      dec(i);
      f[l]:=i-l+1;
    end;
    inc(i);
  end;
  i:=1;
  while i <= n do begin
    if f[i] = 0 then write(s[i]) else begin write('***'); i:=i+f[i]-1; end;
    inc(i);
  end;
  writeln;
end.

var s:string;
n,i,l,k:integer;
begin
  readln(n);
  readln(s);
  i:=1;
  i:=pos('ogo',s);
  while i<>0 do
  begin
  delete(s,i,3);
  insert('***',s,i);
  l:=length(s);
  k:=3;
  while((i+k+1)<=l) and (s[i+k]='g') and (s[i+k+1]='o') do
          begin
            delete(s,i+k,2);
            l:=l-2;
          end;
  i:=pos('ogo',s);
  end;
  write(s);
end.

var
   s,p:string;
   k,i,n:longint;
begin
readln(n);
readln(s);
p:='ogo';
i:=1;
while i<=length(s) do begin
if copy(s,i,3)=p then begin
   delete(s,i,3);
   k:=i;
   if copy(s,k,2)='go' then begin
   while copy(s,k,2)='go' do
         k:=k+2;
   delete(s,i,k-i);
   end;
   insert('***',s,i);
   i:=i+3;
   end
   else i:=i+1;
end;
writeln(s);
end.

var
  n, i, b, a: integer;
  s1, s: string;

begin
  readln(n);
  readln(s);
  i:=1;
 while (i<=n) do
  begin
    if (s[i] = 'o') and (s[i + 1] = 'g') and (s[i + 2] = 'o') then begin
      delete(s, i, 3);
      insert('***', s, i);
      i+=2;
      while (i<n)and (s[i+1]='g') and (s[i+2]='o')do begin
            delete(s, i+1, 2);
      //insert('***', s, i);
     n-=2;
      //i+=3;
      end;
    end;
    i+=1;
  end;

  writeln(s);

end.

var
 s,c: string;
 p: integer;
begin
 readln(p);
 readln(s);
 c:='ogo';
 while length(c)+2<=length(s) do
  c:=c+'go';
 while length(c)>2 do
 begin
  while pos(c,s)>0 do
  begin
   p:=pos(c,s);
   delete(s,p,length(c));
   insert('***',s,p);
  end;
  delete(c,length(c)-1,2);
 end;
 writeln(s);
end.

program tcupA;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var n, p, f: integer;
  s: string;
begin
  readln(n);
  readln(s);
  p:=pos('ogo', s);
  while p <> 0 do begin
    Delete(s, p, 3);
    Insert('***', s, p);
    f:=1;
    while f <> 0 do
      if (s[p+3] ='g') and (s[p+4] = 'o') then
        Delete(s, p+3, 2)
      else
        f:=0;
    p:=pos('ogo', s);
  end;
  writeln(s);
  readln; readln;
end.

var s,c:string;
n,i,k, x: integer;
begin
  readln(n);
  readln(s);
  s:=s+'  ';
  k:=1;
  while (pos('ogo', s)>0) do begin
    x:=pos('ogo', s);
    i:=x+3;
    while (s[i]='g')and(s[i+1]='o') do i:=i+2;
    for k:=x to i-1 do begin
      delete(s,x,1);
    end;
    insert('***',s,x);
  end;
  write(s);
end.

var n,i:integer; s,g:string;
begin
readln(n);readln(s);
i:=1;
while i<length(s) do begin
g:=copy(s,i,3);
if g='ogo' then
begin delete(s,i,3); insert('***',s,i); i:=i+3; g:=copy(s,i,2);
while g='go' do begin
delete(s,i,2); g:=copy(s,i,2); end;
end
else i:=i+1;
end;
writeln(s);
end.

var n,i,j,k:integer;
    a:array [1..100] of string;
s:string;
l:char;
begin
    readln(n);
    s:='';
    for i:=1 to n do begin
        read(l);
        s:=s+l;
    end;
    i:=1;
    j:=1;

    while i<=length(s) do begin
          k:=0;
          if s[i]='o' then begin
             while (i<length(s)-1) and (s[i+1]='g') and (s[i+2]='o') do begin
                  i:=i+2;
                  k:=1;
           end;
           if k=1 then begin
             a[j]:='*';
             j:=j+1;
             a[j]:='*';
             j:=j+1;
             a[j]:='*';
             j:=j+1;
             i:=i+1;
          end
          else begin
              a[j]:=s[i];
              j:=j+1;
              i:=i+1;
          end;
          end
          else begin

            a[j]:=s[i];
            j:=j+1;
            i:=i+1;
          end;

    end;
    for i:=1 to n do write(a[i]);
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var i, j, n, m : longint;
    s, new : string;
begin
 // assign(input, 'input.txt'); assign(output, 'output.txt');

  readln(n);
  readln(s);
  i := 1;
  new := '';
  while i <= n-2 do
  begin
    if (s[i] = 'o') and (s[i+1] = 'g') and (s[i+2] = 'o') then
      begin
        new := new + '***';
        i := i + 3;
        while (i < n) and (s[i] = 'g') and (s[i+1] = 'o')  do
          i := i + 2;
      end
    else
      begin
        new := new + s[i];
        inc(i);
      end;
  end;

  for j := i to n do
    new := new + s[j];

  writeln(new);
end.

program A;

var
  s, s1: string[100];
  len, i, n, z: byte;

begin
  readln(n);
  readln(s);

  s1 := 'ogo';
  for i := 1 to ((n - 3) div 2) do s1 := s1 + 'go';

  len := ((n - 3) div 2) * 2 + 3;

  while 3 < len do
  begin
    while pos(s1, s) <> 0 do
    begin
      z := pos(s1, s);
      delete(s, z, len);
      insert('***', s, z);
    end;
    len := len - 2;
    delete(s1, len, 2);
  end;

  while pos(s1, s) <> 0 do
  begin
    z := pos(s1, s);
    delete(s, z, len);
    insert('***', s, z);
  end;

  writeln(s);
end.

program dfgdf;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
    i, n: integer;
    s, a: string;
begin
    readln(n);
    readln(s);
    i := 1;
    a := '';
    while(i <= n) do begin
        if(s[i] = 'o') and (s[i + 1] = 'g') and (s[i + 2] = 'o') then begin
            inc(i, 3);
            a := a + '***';
            while(s[i] = 'g') and (s[i + 1] = 'o') do
                inc(i, 2);
        end
        else begin
            a := a + s[i];
            inc(i);
        end;
    end;
    writeln(a);
end.

var a:string;
    i,p,n:integer;
    flag:boolean;
begin
  readln(n);
  readln(a);
  i:=1;
  while(i<=n) do
    begin
       while(i<=n) and(a[i]<>'o') do
        begin
          write(a[i]);
          inc(i);
        end;
       inc(i);
       flag:=false;
       while(i<n) and (a[i]='g') and (a[i+1]='o') do
          begin
            inc(i,2);
            flag:=true;
          end;
       if(flag) then
        write('***')
       else if (i-1<=n) then
        write('o');
    end;

end.

var
   n,i,f: longint;
   s: string;
begin
   readln(n);
   read(s);
   i:=0;
   f:=0;
   while i<length(s) do
      begin
         i:=i+1;
         if f=0 then if i+2<=length(s) then if (s[i]='o') and (s[i+1]='g') and (s[i+2]='o') then begin
               s[i]:='*';
               s[i+1]:='*';
               s[i+2]:='*';
               f:=1;
               i:=i+3;
            end;
         if f=1 then if i+1<=length(s) then if (s[i]<>'g') or (s[i+1]<>'o') then begin
            f:=0;
            i:=i-1;
         end;
         if f=1 then if i+1<=length(s) then if (s[i]='g') or (s[i+1]='o') then begin
                                                                        delete(s,i,2);
                                                                        i:=i-1;
                                                                      end;
      end;
   write(s);
end.

const fi='';
var n,i:longint;
    s:string;
    f:text;
    ok:array[1..109] of boolean;
//------------------------------------------
begin
 assign(f,fi);
 reset(f);
 readln(f,n);
 readln(f,s);
 fillchar(ok,sizeof(ok),true);
 for i:=1 to n-2 do
  begin
   if (s[i]='o') and (s[i+1]='g') and (s[i+2]='o') then
    begin
     ok[i]:=false;
     ok[i+1]:=false;
     ok[i+2]:=false;
    end;
  end;
 i:=1;
 while i<=n do
  begin
   if ok[i]=true then
    begin
     write(s[i]);
     inc(i);
    end
   else
   begin
    write('***');
    i:=i+3;
    while (ok[i]=false) and (s[i]<>s[i-1]) do
    inc(i);
  //  if s[i]=s[i-1] then inc(i);
   end
  end;
end.

program x1;
var n,b,k:integer;s:string;
begin
readln(n);
readln(s);
k:=pos('ogo',s);
while k>0 do begin
b:=k+3;
while (b<length(s))and(s[b]='g')and(s[b+1]='o') do
b:=b+2;
delete(s,k,b-k);
insert('***',s,k);
k:=pos ('ogo',s);
end;
writeln(s);
end.

program prog;
var
  p1,p2,n,i:byte;
  input:string;
  lol:boolean;
begin
readln(n);
readln(input);
p1 := pos('ogo', input);
while p1 <> 0 do
begin
  lol := false;
  p2 := p1 + 2;
  for i:=p1+3 to length(input) do
    if lol AND (copy(input, i, 1) = 'o') OR NOT(lol) AND (copy(input, i, 1) = 'g') then
    begin
      if lol = true then
        p2 := i;
      lol := NOT(lol);
    end
    else
      break;

  delete(input, p1, p2 - p1 + 1);
  insert('***', input, p1);

  p1 := pos('ogo', input);
end;

write(input);
end.

var n,i,j,k,l:longint;
s,s1,s2:ansistring;
begin
readln(n);
readln(s);
s1:='ogo';
while pos(s1,s)>0 do begin
    i:=pos(s1,s);
    l:=3;
    delete(s,i,l);
    insert('***',s,i);
  //  writeln(s);
    while pos('*go',s)>0 do begin
        i:=pos('*go',s);
        l:=3;
        delete(s,i,l);
        insert('*',s,i);
     //   writeln(s);
    end;
end;
s1:='*go';
//writeln;
while pos(s1,s)>0 do begin
    i:=pos(s1,s);
    l:=3;
    delete(s,i,l);
    insert('*',s,i);
//    writeln(s);
end;
writeln(s);
end.

const fi = '';
    fo = '';

var n, i, j: longint;
    s, res: string;
    f: text;

begin
    assign(f, fi); reset(f);
    readln(f, n);
    readln(f, s);
    close(f);

    i:= 1; res:= '';
    while(i<=n) do
        if((i<=n-2)and(s[i]='o') and (s[i+1]='g') and (s[i+2]='o')) then
        begin
            j:= i+3;
            while ((j<n)and(s[j]='g')and(s[j+1]='o')) do j:= j+2;
            res:= res+'***';
            i:= j;
        end
        else
        begin
            res:= res+s[i]; inc(i);
        end;
    writeln(res);
    readln;
end.

var
 n,i,j,k: longint;
 s,t: shortstring;
begin
 readln(n);
 readln(s);
 s:=s+'#';
 i:=1;
 while i <= n do
 begin
  k:=0;

  if s[i] = 'o' then for j:=i to n do
  begin
   inc(k);

   if (s[j] = 'g') and (s[j+1] <> 'o') then
   if k >= 3 then
   begin
    t:=t+'***';
    i:=j-1;
    break;
   end else begin t:=t+s[i]; break; end;

   if (s[j] = 'o') and (s[j+1] <> 'g') then
   if k >= 3 then
   begin
    t:=t+'***';
    i:=j;
    break;
   end else begin t:=t+s[i]; break; end;

  end else t:=t+s[i];

  inc(i);
 end;

 writeln(t);
end.

var t,s: ansistring;
    i,n,j: longint;

procedure xuli;
  begin
    i:=1;
    repeat
      if s[i]+s[i+1]+s[i+2]='ogo' then
        begin
          j:=i+1;
          while s[j]+s[j+1]='go' do inc(j,2);
          write('***');
          i:=j;
        end
      else
        begin write(s[i]); inc(i); end;
    until i>n;
  end;

BEGIN

  readln(n);
  readln(s);
  s:=s+'aa';
  xuli;

END.

var s,s1:string;
    n,i:longint;
begin
    readln(n);
    readln(s);
    s1:='';
    i:=1;
    while i<=n do
        if (i+1<n)and(s[i]='o')and(s[i+1]='g')and(s[i+2]='o') then
            begin
                s1:=s1+'***';
                i:=i+3;
                while (i<n)and(s[i]='g')and(s[i+1]='o') do i:=i+2;
            end
        else
        begin
            s1:=s1+s[i];
            inc(i);
        end;
    writeln(s1);
end.

var s:string;
    l,i:integer;
    winston:boolean;
begin
readln(l);
readln(s);
i:=1;
while (i<=l) do
 begin
  if (s[i]='o')and(s[i+1]='g')and(s[i+2]='o') then
   begin
    write('***');
    i:=i+3;
    winston:=true;
    while (winston)and(i<=l) do
     begin
      if (s[i]='g')and(s[i+1]='o') then
       i:=i+2
      else winston:=false;
     end;
   end else
    begin
     write(s[i]);
     i:=i+1;
    end;
 end;
end.

program z1;
var s: string;
    k,i,n: integer;
begin
  readln(n);
  readln(s);
  k:=pos('ogo',s);
  while k>0 do begin
    i:=k+3;
    while (i<length(s))and(copy(s,i,2)='go') do i:=i+2;
    delete(s,k,i-k);
    insert('***',s,k);
    k:=pos('ogo',s);
  end;
  writeln(s)
end.

program technocup;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  s, s1: string;
  i, f: integer;
  b: boolean;

begin
  readln(f);
  readln(s);
  i := 1;
  while i <= length(s) do
  if (s[i] = 'o') and (s[i + 1] = 'g') and (s[i + 2] = 'o') then
  begin
    inc(i, 3);
    s1 := s1 + '***';
    b := true;
    while b do
      if (s[i] = 'g') and (s[i + 1] = 'o') then inc(i, 2)
      else b := false;
  end
  else
  begin
    s1 := s1 + s[i];
    inc(i);
  end;
  writeln(s1);
end.

program z1;
var a,b,c,d,i,j,k,l,m,n,zh:longint; s,sans:ansistring;
begin
//assign(input,'d:\input.txt'); reset(input);
//assign(output,'d:\output.txt'); rewrite(output);
readln(n);
readln(s); s:=s+'  ';
i:=1;
while i<=n do
 begin
 if zh<>0 then
 if (s[i]='g') and (s[i+1]='o') then begin i:=i+2; continue; end else zh:=0;
 if zh=0 then
 begin
 if (s[i]='o') and (s[i+1]='g') and (s[i+2]='o') then begin sans:=sans+'***'; zh:=1; i:=i+3; continue; end;
 sans:=sans+s[i]; inc(i);
 end;
 end;
writeln(sans);
end.

program ideone;
var
	srt,strt:string;
	irt:longint;
begin
	readln(irt);readln(srt);
	irt:=1;
	while irt<=length(srt) do
	begin
		if srt[irt]+srt[irt+1]+srt[irt+2]='ogo' then
		begin
			strt:=strt+'***';irt:=irt+3;
			while srt[irt]+srt[irt+1]='go'
			 do irt:=irt+2;
		end
		else
		begin
			strt:=strt+srt[irt]; irt:=irt+1;
		end;
	end;
	writeln(strt);
end.

var
 s,v:ansistring;
 i,j,n,ch1,ch2,k,l,o:longint;
begin
 readln(n);
 readln(s);
 //v:=s;
 v:='';
 i:=1;
 while i<=n do
 begin
 // writeln(i);
  if(s[i]='o')and(s[i+1]='g')and(s[i+2]='o')then
  begin
   //writeln(i);
   ch1:=i;
   i:=i+3;
  // writeln(ch1);
   if i+1<=n then
   while (s[i]='g')and(s[i+1]='o')do
   begin
    //writeln(n);
    inc(i,2);
    if i+1>n then break;
   end;
  // for j:=ch1 to i-1 do s[j]:='*';
   v:=v+'***';
  end else
 begin inc(i);  v:=v+s[i-1]; end;
 end;
 writeln(v);
end.

var a, b: String; i, n, j, k: integer;
begin

readln(n);
readln(a);

j:=0;

i:=1;

while i<=n do
begin

  k:=0;

  if (a[i]='o') and (a[i+1]='g') and (a[i+2]='o') then
  begin

    if (i+4<=n) and (a[i+3]='g') and (a[i+4]='o') then
    begin

      j:=i+5;

      while (j<n) and (a[j]='g') and (a[j+1]='o') do
      begin

        k:=k+1;
        j:=j+2;

      end;

      delete(a,i+3,k*2+2);

      n:=n-k*2-2;

    end;

    delete(a,i,3);

    Insert('***', a, i);

    i:=i+3;

  end

  else

  i:=i+1;

end;

write(a);

end.

program one;

var
  n, i, Position: integer;
  s, sWork, sNew: string;
  k: boolean;

begin
  Readln(n);
  Readln(s);
  k := False;
  sWork := s;
  repeat
    Position := Pos('ogo', sWork);
    if Position <> 0 then begin
      sNew := sNew + Copy(sWork, 1, Position - 1) + '***';
      Delete(sWork, 1, Position + 2);
      while(2 <= length(sWork)) do
      begin
        if (sWork[1] = 'g') and (sWork[2] = 'o') then
          Delete(sWork, 1, 2)
        else Break;
      end;
    end
    else k := True;
  until(k);
  sNew := sNew + sWork;
  Writeln(sNew);
end.

var
  s: string;
  i, n: integer;

begin
  readln(n);
  readln(s);

    while pos('ogo', s) <> 0 do begin
      i := pos('ogo', s);
      while (i+4<=length(s)) and (s[i + 3] = 'g') and (s[i + 4] = 'o') do begin
        delete(s, i + 3, 2);
      end;
      s[i] := '*';
      s[i + 1] := '*';
      s[i + 2] := '*';
    end;

  writeln(s);
end.

var
  s: string;
  i, n, k, q, j: integer;

begin
  readln(n);
  readln(s);

    while pos('ogo', s) <> 0 do begin
        i := pos('ogo', s);
      while (i+4<=length(s)) and (s[i + 3] = 'g') and (s[i + 4] = 'o') do begin
        delete(s, i + 3, 2);
      end;
      s[i] := '*';
      s[i + 1] := '*';
      s[i + 2] := '*';
    end;

  writeln(s);
end.

uses math;
var n,d,i,j,ans:longint;
    s,s1:string;
begin
readln(n);
read(s);
n:=length(s);
if s='ogo' then begin write('***'); halt; end;
if n<=3 then begin write(s); halt; end;
i:=1;
while i<=n-2 do
begin
s1:=s[i]+s[i+1]+s[i+2];
if s1='ogo' then write('***') else write(s[i]);
if s1='ogo' then begin
                 i:=i+3;
                 while i<n do
                 if s[i]+s[i+1]='go' then i:=i+2 else break;
                 end else inc(i);

end;
for j:=i to n do
write(s[j]);
end.

var n,i:integer; s,g:string;
begin
readln(n);readln(s);
i:=1;
while i<length(s) do begin
g:=copy(s,i,3);
if g='ogo' then
begin delete(s,i,3); insert('***',s,i); i:=i+3; g:=copy(s,i,2);
while g='go' do begin
delete(s,i,2); g:=copy(s,i,2); end;
end
else i:=i+1;
end;
writeln(s);
end.

{$OPTIMIZATION LEVEL2}
{$INLINE ON}
uses math;
const fi='';
      fo='';
      maxn=101;

var f1,f2:text;
    s:string;
    n:longint;

procedure openfile;
 begin
  assign(f1,fi);
  reset(f1);
  assign(f2,fo);
  rewrite(f2);
 end;

procedure closefile;
 begin
  close(f1);
  close(f2);
 end;

procedure input;
 var i,j:longint;
 begin
  readln(f1,n);
  readln(f1,s);
 end;

procedure init;
  var i,j:longint;

  begin

  end;

procedure solve;
  var i,j:longint;
      s1:string;
  begin
   s1:='***';
   s:=copy(s,1,n);
   s:=s+'  ';
   i:=1;
   while i<=length(s)-4 do
    begin
     if (copy(s,i,3)='ogo') then
      begin
       j:=i+3;
       while (copy(s,j,2)='go')and(j<=length(s)-3) do
        j:=j+2;
       delete(s,i,j-i);
       insert(s1,s,i);
      end;
     inc(i);
    end;
  end;

procedure output;
  var i:longint;
  begin
   writeln(f2,s);
  end;

begin
 openfile;
 input;
 init;
 solve;
 output;
 closefile;
end.

var s,c:string;
n,i,k, x: integer;
begin
  readln(n);
  readln(s);
  s:=s+'  ';
  k:=1;
  while (pos('ogo', s)>0) do begin
    x:=pos('ogo', s);
    i:=x+3;
    while (s[i]='g')and(s[i+1]='o') do i:=i+2;
    for k:=x to i-1 do begin
      delete(s,x,1);
    end;
    insert('***',s,x);
  end;
  write(s);
end.

var
  f,ii,i,n:integer;
  b,s:string;
begin
  b:='***';
  readln(n);
  readln(s);
  i:=1;
  s:=s+'11111';
  while i<=n do
    begin
      if s[i]='o' then
        if(s[i+1]='g')and(s[i+2]='o')then
          begin
            f:=1;
            ii:=i+2;
            while f=1 do
              begin
                f:=0;
                if(s[ii+1]='g')and(s[ii+2]='o')then
                  begin
                    f:=1;
                    ii:=ii+2;
                  end;
              end;
            delete(s,i,ii-i+1);
            insert(b,s,i);
            n:=n-(ii-i-3+1);
            i:=i+2;
          end;
      i:=i+1;
    end;
  for i:=1 to length(s) do
    if s[i]<>'1' then
      write(s[i]);
end.

program polycarp;
const fi = '';
      fo = '';
      maxn = 100000;
var f,g : text;
    a : array[1..maxn] of char;
    n : longint;
procedure nhap;
var i : longint;
begin
   assign(F,fi);
   assign(g,fo);
   reset(f);
   rewrite(g);
   readln(F,n);
   for i := 1 to n do read(f,a[i]);
end;
procedure process;
var i,j : longint;
    ok : boolean;
begin
  i := 1;
  repeat
    if (a[i] <> '*') and (i <= n-2) then
    if (A[i] = 'o') and (a[i+1]='g') and (a[i+2] = 'o') then
      begin
        write(g,'***');
        i := i + 3;
        while (i <= n-1) and (A[i]='g') and (A[i+1] = 'o') do
          i := i + 2;
      end;
    if i > n then break;
    if (a[i] <> 'o') or (a[i+1] <> 'g') or (a[i+2] <> 'o') then
      begin
      write(g,a[i]);
      inc(i);
      end;
  until i > n;
end;
   begin
     nhap;
     process;
     close(f);
     close(G);
   end.

var
  i, n, count: longint;
  c: string;
  f: boolean;

begin
  readln(n);
  read(c);
  c := c + '                                    ';
  inc(i);
  repeat
    if (c[i] = 'o') and (c[i+1] = 'g') and (c[i+2] = 'o') then begin
          inc(i, 3);
          while ((c[i] = 'g') and (c[i + 1] = 'o')) do
            inc(i, 2);
            write('***');

 end else begin write(c[i]); i:=i+1; end;
  until(i>n);
end.

var i,n: integer;
s:string;
s1:string;

begin
readln(n);
readln(s);
s1:='***';
while pos('ogo',s)<>0 do
begin
i:=pos('ogo',s);
Delete(s,i,3);
insert(s1,s,i);
while (s[i+3]='g') and (s[i+4]='o') do
begin
delete(s,i+3,2);
end;
end;
write(s);
end.

var
  n, i, b, a: integer;
  s1, s: string;

begin
  readln(n);
  readln(s);
  i:=1;
 while (i<=n) do
  begin
    if (s[i] = 'o') and (s[i + 1] = 'g') and (s[i + 2] = 'o') then begin
      delete(s, i, 3);
      insert('***', s, i);
      i+=2;
      while (i<n)and (s[i+1]='g') and (s[i+2]='o')do begin
            delete(s, i+1, 2);
      //insert('***', s, i);
     n-=2;
      //i+=3;
      end;
    end;
    i+=1;
  end;

  writeln(s);

end.

var n,i,j:integer;
s:string;
a:array[1..100] of char;
begin
readln(n);
readln(s);
i:=1;
j:=1;
while i<=n-2 do
      if copy(s,i,3)<>'ogo' then begin
            a[j]:=s[i];
            j:=j+1;
            i:=i+1;
            end else begin
                  a[j]:='*';
                  a[j+1]:='*';
                  a[j+2]:='*';
                  j:=j+3;
                  i:=i+3;
                  while (i<n)and(copy(s,i,2)='go')do i:=i+2;
                  end;
while i<=n do begin
    a[j]:=s[i];
    i:=i+1;
    j:=j+1;
    end;
for i:=1 to j-1 do write(a[i]);
end.

var s,s2:string;
i,n,r,l,j:longint;
begin
  readln(n);
  readln(s);
  i:=1;
  while true do
    begin
      if (s[i]='o')and(s[i+1]='g')and(s[i+2]='o') then begin
                                          j:=i+2;
                                          while j<=n do
                                            begin
                                              if (s[j+1]='g')and(s[j+2]='o')
                                              then begin
                                                     j:=j+2;
                                                   end
                                              else break;
                                            end;
                                          i:=j+1;
                                          s2:=s2+'***';
                                                       end
                                          else begin
                                                 s2:=s2+s[i];
                                                 i:=i+1;
                                               end;
      if i>n then break;
    end;
  writeln(s2);
end.

var b,k,n,i:integer; a:array of char;
begin
readln(n); setlength(a,n+1);
for i:=1 to n-1  do
read(a[i]); readln(a[n]);
for i:=1 to n-2 do
if (a[i]='o') and(a[i+1]='g') and (a[i+2]='o') then
begin
a[i]:='*';a[i+1]:='*'; a[i+2]:='*';
k:=i+3;
if (k+1<=n) then
while (a[k]='g') and ( a[k+1]='o') do
begin
a[k]:='A';a[k+1]:='A'; k:=k+2; if (k+1>n) then break end;
end;
for i:=1 to n do
BEGIN
IF (a[i]<>'A') then
write(a[i]); end;
end.

var s,ans:string;
    i,z,useless:longint;
procedure check(x:longint);
 var i,q:longint;
begin
 q:=0;
 for i:=1 to length(s)-x do
  begin
   if ((i mod 2 = 1)and(s[x+i]<>'g'))or((i mod 2 = 0)and(s[x+i]<>'o'))
    then begin q:=i; break; end;
  end;
 if q=0
  then q:=(length(s)-x)+1;

 if q>2
  then begin delete(s,x,1+((q-1) div 2)*2); ans:=ans+'***';end
  else begin ans:=ans+s[z]; inc(z);end;

end;

begin
 readln(Useless);
 read(s);
 z:=1;
 while z<=length(s) do
  begin
   if s[z]='o'
    then begin
          check(z);

         end
    else begin
          inc(z);
          ans:=ans+s[z-1];
         end;
  end;

 write(ans);
end.

program a;
var s,s1:String;
i,j,p,n:integer;
ready:boolean;
begin
readln(n);
readln(s);
for i:=1 to length(s)-2 do
if(copy(s,i,3)='ogo') then begin
ready:=false;
j:=i+3;
while(ready=false) do begin
s1:=copy(s,j,2);
if s1<>'go' then
ready:=true
else
j:=j+2;
end;
delete(s,i,j-i);
insert('***',s,i);
end;
writeln(s);
end.

var a,s:string;
i,n,t,d:longint;

begin
readln(n);
readln(s);
a:='';
i:=1;
t:=0;d:=0;
while i<=length(s) do
        begin
        if s[i]='o' then
                begin
                inc(d);
                if s[i+1]+s[i+2]='go' then
                        begin
                        t:=1;
                        i:=i+2;
                        end
                else
                if s[i+1]+s[i+2]<>'go' then
                        begin
                        if d<>0 then
                                begin
                                if t=1 then a:=a+'***'
                                else a:=a+'o';
                                t:=0;
                                end;
                        inc(i);
                        d:=0;
                        end;
                end;
        if i<=length(s) then
        begin
        if s[i]<>'o' then
                begin
                a:=a+s[i];
                inc(i);
                end;
        end;
        end;
writeln(a);
end.

                      const eps=0.0000000001;  besk1=200000008;  nnn=4600000;
            besk=80000000000000000;
              modul={1000000007}{998244353}100;

   label 22,1,2,3,4,33;
    type    real=extended;   double=extended;
    mas=array [-300000..nnn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3,p4 :int64;end; zap1=^zap;
    mass=array[-10000..nnn] of longint;mass1=^mass;
    matr=array[-10..200,-10..200] of int64;
    matr1=^matr;
    var oldq,ll,rr,maskk,otmin,otmax,izb,kol,oldpp,t,pos1,pos2,r,razm,kollad,leftx,rightx,lefty,righty,num,dirx,diry,oldii,obr,koludal,maxdl,mindl,tmin,aaa,bbb,ccc,kolst,kollek,aa,bb,t1,t2,kolx,koly,ans,ans2,dl,posleft,posright,n,xxx,yyy,dx,dy,m,w,h,jjj,l,cc,mnog,nn,t3,t4,t5,t6,posmax,tmax,kold,kk,j2,ttt,ppp,pmin,pmax,limit,posi,posj,diam,oldt,ot1,time,pos,posx,posy,dloch,newdl,oldn,oldm,ost,ot,p1,p2,p3,p4,znamzz,kolperiod,znam,tperiod,start,finish,kol1,kol2,lavel,p0,jj,ii,ogr,q,p,pp,tt,oldtt,qq,qq1,qq2,q1,q2,imax,nm,smin,cen:int64;
   istart,jstart,ifinish,jfinish,k,i2,i3,step2,k1,k2,pp0,mask,i1,j1,step1, step, i,j:longint;
   zagr,xx,yy,kolizm,test,zz,predok,hesh,yold,x1,x0,d,b,a,zsum,y,x,z:array[-200000..1535002] of int64;
    otmat,amat,bmat,cmat:matr;
    zan1,zan2:array[-1000..200000,-2..26] of boolean;
    marked1,marked2:array[-2000..2000000] of boolean;
   gr1,gr2,gr:array[-1..2000,-1..2000] of boolean;
    dd,ddr:array[-1..1502,-1..1502] of int64;
    prob1,prob2,prob3,pr1new,pr2new,pr3new,pr1,pr2,pr3:zap;
    iii,oldpos,finot,vv,znak:int64;
    aold:mas;  anss:zap;
    sss,ss,ss1,ss2:string;
    newstr,str:array[-1000..200000] of string;
    lll,rrr,v,dist,alpha,phi:extended;
    masmatr:array[-1..101,-1..101,-1..101] of int64;
    zzz,ddnew,koef,polex,ddsum,ddl:array[-1..4,-1..1300000] of int64;
    str1,str2,dpos,sum,ppos,mma,ma:array[-1000..200005,-1..30] of int64;
    xleft,xright,xplus,xminus,px,py,xc,yc,xxc,yyc:extended;
    del:array[-1..100001,-1..20] of longint;
    z0,y1,z1,z2,kolnul,fact,next,prev,s,name,dnew, voltay,c,day:mas;
    zzzz:array[0..125000000] of byte;
    aaaa,bbbb,x2:extended;
    delit:array[0..100000,0..20] of longint;
    pole:array[-10..2002,-10..2005] of char;
    ddd,matrr,ppole,dd3,dd4:array[-10..2000,-10..2200] of int64;
    ddnnew:array[-1..12,-1..12,0..200,0..3] of int64;
   newzan,marked,zanx,zany:array[-1000000..2000000] of boolean;
    ssold,sss1,sss2:string;
    def,stepen,koled,och,newoch,place,newnabor,stoim,nabor:array[-10..500005] of int64;
     zanleft,zanright,zan,fl:array[-100000..10000000] of boolean;
     dost:array[-1..210,-1..210,0..3,0..3] of int64;
    sss12:string;ch,ch1,ch2:char;
    pr,heshh,numright,dr: array [-10..206,-1..16] of int64;
    s3,s2,s1:array[-100..500000] of string;

    grr :array [-10..2010,-10..2010] of extended;
    maxpr:array[0..nnn] of string;
     tx,ty,vel,ott,v0,v1,s0,t0:int64;
     zv:point;
     left,right,ugol,rot,temp,sumtemp,vol,newx,newy:array[-1000..400000] of int64;
     mash,sqx,sqy,ottt:extended;
     xxxx,yyyy,yot:double;
       flag2,flag,flag1:boolean;

  function max(a,b:int64):int64;
begin max:=a; if b>a then max:=b;   end;

  function min(a,b:int64):int64;
begin min:=a; if b<a then min:=b;   end;

procedure udal(p:longint);
begin  next[prev[p]]:=next[p]; prev[next[p]]:=prev[p]; end;

      function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

     function summ(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p2+xx.p2*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=t1 div tt mod modul;
    t2:=t2 div tt mod modul;
    ott.p1:=t1; ott.p2:=t2;

   summ:=@ott;
 end;

     function prod(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=(t1 div tt) mod modul;
    t2:=(t2 div tt) mod modul;
    ott.p1:=t1; ott.p2:=t2;

   prod:=@ott;
 end;

    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p{/pi*180};
 end;

function degg(a,k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=degg(a,k-1)*a mod modul else
   begin  p:=degg(a,k shr 1); degg:=p*p mod modul;   end;

end;

function prost(tt:int64):boolean;
var aa:extended; i,p,t:longint;  fl:boolean;
 begin
   fl:=true;
   aa:=tt;
   aa:=sqrt(aa);
   t:=round(aa);
   for i:=2 to t do if tt mod i=0 then begin fl:=false; break; end;

   prost:=fl;
 end;

function arcsin(pp:extended):extended;
var tt:extended;
begin
   if (abs(pp)<=1+eps)and (abs(pp)>=1-eps)
   then if pp>0 then arcsin:=pi/2 else arcsin:=-pi/2;
   tt:=1-pp*pp;
   if abs(tt)>=0 then
     begin
        arcsin:=arctan(pp/sqrt(tt));

     end;

end;

function gl(ch:char):boolean;
begin
 if (ch='o')or (ch='a')or(ch='e')or(ch='u')or(ch='i') then gl:=true else gl:=false;

end;

function zaprmin(left,right:longint):int64;
begin
   if left>=right then zaprmin:=y[left] else
     begin
        if not odd(left) and odd(right) then zaprmin:=zaprmin(left shr 1,right shr 1) else
         begin
          if odd(left) then zaprmin:=min(zaprmin(left+1,right),y[left]);
          if not odd(right) then zaprmin:=min(zaprmin(left,right-1),y[right]);

         end;

     end;

end;

 function ff(gr:int64):boolean;

var ot,aa,bb,cc:int64; fl:boolean;
begin
  aa:=1; bb:=m;  cc:=aa; fl:=false;
  while abs(aa-bb)>1 do
    begin
       cc:=(aa+bb) shr 1;
       if y[cc]<gr then aa:=cc else bb:=cc;

    end;
   writeln(' cc= ',cc);
   cc:=min(cc+3,m+1);
   repeat dec(cc) until y[cc]<=gr;
   if y[cc]=gr then fl:=true else fl:=false;
  ff:=fl;
end;

function ogo(ll,rr:longint):boolean;
var i,j,k:longint; fl:boolean;

begin
  fl:=true;
  for i:=ll to rr do if (odd(i-ll) and (ss[i]<>'g'))or ((not odd(i-ll)) and (ss[i]<>'o')) then fl:=false;
  if ss[rr]<>'o' then fl:=false;
 ogo:=fl;
end;

function maxogo(ll,rr:longint):boolean;
var i,j:longint; fl:boolean;
begin
   fl:=ogo(ll,rr);
   if ogo(ll-2,rr) or ogo(ll,rr+2) then fl:=false;
   if rr-ll<2 then fl:=false;
   maxogo:=fl;
end;

begin
  {  assign (input,'D:\Projects\input.txt');reset(input);
      assign (output,'D:\Projects\output.txt'); rewrite(output);
   }

      readln(n);
      readln(ss);
2:      for i:=1 to n do for j:=i to n do if maxogo(i,j) then
        begin
           flag:=true;
           ss1:=copy(ss,1,i-1);
           ss2:=copy(ss,j+1,n-j+1);
           {writeln('i= ',i,'  j= ',j);
           writeln('ss1= ',ss1);
           writeln('ss2= ',ss2);
          } ss:=ss1+'***'+ss2;
           n:=length(ss);
          { writeln(ss); }
        end;
        if flag then begin flag:=false; goto 2;   end;

         writeln(ss);

     goto 1;

     readln(p,t);
     q:=1;
     x[1]:=p;
     ll:=q;
     rr:=q;
     for step:=1 to 30 do
       begin
          for i:=ll to rr do if 2*x[i]<2000000000 then begin inc(q); x[q]:=2*x[i]; y[q]:=i;  end;
          for i:=ll to rr do if 10*x[i]+1<2000000000 then begin inc(q); x[q]:=10*x[i]+1; y[q]:=i; end;
          ll:=rr+1; rr:=q;

       end;

      writeln('q= ',q);
      for i:=1 to q do write(x[i],' '); writeln;

      for i:=1 to q do if x[i]=t then begin flag:=true; ii:=y[i];  end;
      if not flag then writeln('NO');

      while (y[ii]<>1)and(tt<100) do begin inc(tt); z[tt]:=y[ii]; ii:=y[ii];   end;

     writeln('tt= ',tt);
    { for i:=1 to tt do write(x[])
     }

1:             close(output);
end.

program ogogo;

var n, i, j: Byte;
    s, res: String;

begin

  readln (n);
  readln (s);

  for i := 3 to n do
  begin
    if (s[i-2] = 'o') and (s[i-1] = 'g') and (s[i] = 'o') then
    begin
      for j := 0 to 2 do
      begin
        s[i-j] := '*';
      end;
      while (i < n-1) and (s[i+1] = 'g') and (s[i+2] = 'o') do
      begin
        delete (s, i+1, 2);
        dec (n, 2);
      end;
    end;
  end;

  writeln (s);

end.

program zad_a;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
	s, w: string;
    str: array [0..1000] of string;
    len: array [0..1000] of integer;
    i, j, m, n, k: integer;

begin
	readln(n);
	readln(s);
    str[1] := 'ogo';
    len[1] := 3;
    for i := 2 to 100 do
    begin
    	str[i] := str[i - 1] + 'go';
        len[i] := length(str[i]);
    end;

    for i := 100 downto 1 do
    	while (pos(str[i], s) > 0) do
        begin
        	k := pos(str[i], s);
        	delete(s, pos(str[i], s), len[i]);
            insert('***', s, k);
        end;

    writeln(s);
    readln;readln;readln;

end.

var a, b: String; i, n, j, k: integer;
begin

readln(n);
readln(a);

j:=0;

i:=1;

while i<=n do
begin

  k:=0;

  if (a[i]='o') and (a[i+1]='g') and (a[i+2]='o') then
  begin

    if (i+4<=n) and (a[i+3]='g') and (a[i+4]='o') then
    begin

      j:=i+5;

      while (j<n) and (a[j]='g') and (a[j+1]='o') do
      begin

        k:=k+1;
        j:=j+2;

      end;

      delete(a,i+3,k*2+2);

      n:=n-k*2-2;

    end;

    delete(a,i,3);

    Insert('***', a, i);

    i:=i+3;

  end

  else

  i:=i+1;

end;

write(a);

end.

var
 s:ansistring;
 n,m,i,k,j,f,t,c,x,y,z,q,w:longint;
begin
 readln(n);
 readln(s);
 s:=s+'!!!';
 while pos('ogo',s)>0 do
 begin
  i:=pos('ogo',s);
  w:=3;
  while(s[i+w]='g')and(s[i+w+1]='o')do inc(w,2);
  delete(s,i,w);
  insert('***',s,i);
 end;
 s:=copy(s,1,length(s)-3);
 writeln(s);
end.

Var
i,j,n,h,k:integer;
s,d,og:string;
begin
d:='ogo';
readln(n);
readln(s);

for j:=49 downto 1 do begin
og:=d;

  for h:=1 to j do og:=og+'go';

  for k:=1 to 33 do begin

    i := Pos(og, s);
    if i > 0 then
      begin
       Delete(s, i, ((j*2)+3));
       Insert('***', s, i);

      end;
  end;
end;

  for k:=1 to 33 do begin

    i := Pos('ogo', s);
    if i > 0 then
      begin
       Delete(s, i, 3);
       Insert('***', s, i);

      end;
      end;

writeln(s);
end.

var t,s: ansistring;
    i,n,j: longint;

procedure xuli;
  begin
    i:=1;
    repeat
      if s[i]+s[i+1]+s[i+2]='ogo' then
        begin
          j:=i+1;
          while s[j]+s[j+1]='go' do inc(j,2);
          write('***');
          i:=j;
        end
      else
        begin write(s[i]); inc(i); end;
    until i>n;
  end;

BEGIN

  readln(n);
  readln(s);
  s:=s+'aa';
  xuli;

END.

program Oleg;
var
  s: string;
  n, plase: integer;
begin
  readln(n);
  readln(s);
  while pos('ogo', s) <> 0 do
  begin
    plase := pos('ogo', s);
    s[plase] := '*';
    s[plase + 1] := '*';
    s[plase + 2] := '*';
    while  (s[plase + 3] = 'g') and (s[plase + 4] = 'o') do
      delete(s, (plase + 3), 2);
  end;
  writeln(s);
end.

var y,j,i,n:integer; s,s1:string;
begin
readln (n);
readln (s);
s1:=s;
for j:=1 to n do begin
i:=pos ('ogo',s1);
if i<>0 then
begin delete (s1,i,3); insert ('***',s1,i); end;
for y:=1 to n-i-4 do
if (s1[i+3]='g') and (s1[i+4]='o' )then begin delete (s1,i+3,2); end;
end;
write(s1);
end.

var
  a, b, n, c, i, i1: longint;
  s: string;

begin
  readln(n);
  readln(s);
  s:=s+'    ';
  i := 1;
  while (i <= n) do
  begin
    if (s[i] = 'o') and (s[i + 1] = 'g') and (s[i + 2] = 'o') then begin
      i := i + 3;
      while ((s[i] = 'g') and (s[i + 1] = 'o')) do
      begin
        i := i + 2;
      end;
      write('***');
    end
    else begin
      if (s[i]<>' ') then write(s[i]);
      inc(i);
    end;
  end;
end.

var i,n: integer;
s:string;
s1:string;

begin
readln(n);
readln(s);
s1:='***';
while pos('ogo',s)<>0 do
begin
i:=pos('ogo',s);
Delete(s,i,3);
insert(s1,s,i);
while (s[i+3]='g') and (s[i+4]='o') do
begin
delete(s,i+3,2);
end;
end;
write(s);
end.

program q;  {$Q+ $R+}
var i, a, d, n, j: longint; c: char;  s: string;

begin
    {assign(input, 'input.txt'); reset(input);
    assign(output, 'output.txt'); rewrite(output);  }
    readln(n);
    readln(s);
    i := 1;
    while i < n - 1 do
    begin
        if (s[i] = 'o') and (s[i + 1] = 'g') and (s[i + 2] = 'o')
        then
        begin
            i := i + 3;
            while (i < n) and (s[i] = 'g') and (s[i + 1]='o') do i := i + 2;
            write('***');
        end
        else begin write(s[i]); inc(i); end;
    end;
    for j := i to n do
    write(s[j]);
end.

var s:string;
    n,vt,i:byte;
    a:array[1..100] of string;
begin
  readln(n);readln(s);a[1]:='ogo';
  For i:=2 to 100 do a[i]:=a[i-1]+'go';
  For i:=100 downto 1 do
    While pos(a[i],s)>0 do
    begin
        vt:=pos(a[i],s);delete(s,vt,length(a[i]));
        insert('***',s,vt);
    end;
    writeln(s);
end.

var s:string;
n,i,l,k:integer;
begin
  readln(n);
  readln(s);
  i:=1;
  i:=pos('ogo',s);
  while i<>0 do
  begin
  delete(s,i,3);
  insert('***',s,i);
  l:=length(s);
  k:=3;
  while((i+k+1)<=l) and (s[i+k]='g') and (s[i+k+1]='o') do
          begin
            delete(s,i+k,2);
            l:=l-2;
          end;
  i:=pos('ogo',s);
  end;
  write(s);
end.

var s , res : string;
	j , i , n : integer;

begin
	readln(n);
	readln(s);
	s := s + 'aa';
	i := 1;
	res := '';
	while i <= n do begin
		if (s[i] = 'o') and (s[i + 1] = 'g') and (s[i + 2] = 'o') then begin
			res := res + '***';
			j := i + 3;
			while (j <= n - 1) and (s[j] + s[j + 1] = 'go') do inc(j , 2);
			i := j;
		end else begin
			res := res + s[i];
			inc(i);
		end;
	end;
	writeln(res);
end.

program a;
var s,s1:String;
i,j,p,n:integer;
ready:boolean;
begin
readln(n);
readln(s);
for i:=1 to length(s)-2 do
if(copy(s,i,3)='ogo') then begin
ready:=false;
j:=i+3;
while(ready=false) do begin
s1:=copy(s,j,2);
if s1<>'go' then
ready:=true
else
j:=j+2;
end;
delete(s,i,j-i);
insert('***',s,i);
end;
writeln(s);
end.

program ideone;
var
	s,st:string;
	i:longint;
begin
	readln(i);
	readln(s);
	i:=1;
	while i<=length(s) do
	begin
		if s[i]+s[i+1]+s[i+2]='ogo' then
		begin
			st:=st+'***';
			i:=i+3;
			while s[i]+s[i+1]='go' do i:=i+2;
		end
		else
		begin
			st:=st+s[i];
			i:=i+1;
		end;
	end;
	writeln(st);
end.

var
  s: string;
  i, n: integer;

begin
  readln(n);
  readln(s);

    while pos('ogo', s) <> 0 do begin
      i := pos('ogo', s);
      while (i+4<=length(s)) and (s[i + 3] = 'g') and (s[i + 4] = 'o') do begin
        delete(s, i + 3, 2);
      end;
      s[i] := '*';
      s[i + 1] := '*';
      s[i + 2] := '*';
    end;

  writeln(s);
end.

const
   tfi='';
   tfo='';

var
   fi, fo: text;
   n: longint;
   s, res: string;

procedure __;
var
   i, j: longint;
begin
   assign(fi, tfi); reset(fi);
   assign(fo, tfo); rewrite(fo);
   readln(fi, n); readln(fi, s);
   i := 1;
   while i<=n do
      begin
         if (s[i]='o') and (i<=n-2) and (s[i+1]='g') and (s[i+2]='o') then
            begin
               res := res+'***';
               j := i+3;
               while j<=n-1 do
                  if (s[j]='g') and (s[j+1]='o') then j := j+2
                  else break;
               i := j;
            end
         else
            begin
               res := res+s[i]; inc(i);
            end;
      end;
   writeln(fo, res);
end;

procedure _;
begin
   close(fi); close(fo);
end;

BEGIN
   __;
   _;
END.

program tcupA;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var n, p, f: integer;
  s: string;
begin
  readln(n);
  readln(s);
  p:=pos('ogo', s);
  while p <> 0 do begin
    Delete(s, p, 3);
    Insert('***', s, p);
    f:=1;
    while f <> 0 do
      if (s[p+3] ='g') and (s[p+4] = 'o') then
        Delete(s, p+3, 2)
      else
        f:=0;
    p:=pos('ogo', s);
  end;
  writeln(s);
  readln; readln;
end.

program Oleg;
var n:byte; s:string;
function poisk(n:byte;s:string):string;
var d:string;k:byte;
begin
while Pos('ogo',s)<>0 do
begin
d:='ogo';
while Pos(d,s)<>0 do d:=d+'go';
Delete(d,length(d)-2,2);
k:=Pos(d,s);
Delete(s,k,length(d));
insert('***',s,k)
end;
poisk:=s;
end;
begin
readln(n);
readln(s);
writeln(poisk(n,s));
readln
end.

var
  q, s: string;
  n, j, i: integer;

begin
  readln(n);
  readln(s);
  q := 'ogo';
  for i := 1 to (n - 3) div 2 do
  begin
    q := q + 'go'
  end;
  while length(q) >= 3 do
  begin
    while pos(q, s) <> 0 do
    begin
      j := pos(q, s);
      delete(s, j, length(q));
      insert('***', s, j);
    end;
    delete(q,length(q)-1,2);
  end;
writeln(s);
end.

var y,j,i,n:integer; s,s1:string;
begin
readln (n);
readln (s);
s1:=s;
for j:=1 to n do begin
i:=pos ('ogo',s1);
if i<>0 then
begin delete (s1,i,3); insert ('***',s1,i); end;
for y:=1 to n-i-4 do
if (s1[i+3]='g') and (s1[i+4]='o' )then begin delete (s1,i+3,2); end;
end;
write(s1);
end.

program project1;

var
  s, r: string;
  i, p, n, z, l: integer;

label
  1;
begin
  readln(n);
  readln(s);
  p := 1;
  while p <= n do
  begin
    r := 'go';
    l := length(s);
    while s[p] <> 'o' do
      Inc(p);
    while copy(s, p + 1, 2) = 'go' do
      Delete(s, p + 1, 2);
    if l > length(s) then
    begin
      Delete(s, p, 1);
      insert('***',s, p);
    end
    else
      Inc(p);
  end;

  writeln(s);
  readln;
end.

var
  n, i, b, a: integer;
  s1, s: string;

begin
  readln(n);
  readln(s);
  i:=1;
 while (i<=n) do
  begin
    if (s[i] = 'o') and (s[i + 1] = 'g') and (s[i + 2] = 'o') then begin
      delete(s, i, 3);
      insert('***', s, i);
      i+=2;
      while (i<n)and (s[i+1]='g') and (s[i+2]='o')do begin
            delete(s, i+1, 2);
      //insert('***', s, i);
     n-=2;
      //i+=3;
      end;
    end;
    i+=1;
  end;

  writeln(s);

end.

var
  i, j, st, fi, n: longint;
  s: string;
begin
  readln(n);
  read(s);
  for i := 1 to n - 2 do begin
    if (s[i] = 'o') and (s[i + 1] = 'g') and (s[i + 2] = 'o') then begin
      s[i] := '*';
      s[i + 1] := '*';
      s[i + 2] := '*';
      j := i + 3;
      while (j < n) do begin
        if (s[j] = 'g') and (s[j + 1] = 'o') then begin
          s[j] := 'G';
          s[j + 1] := 'G';
          j := j + 2;
        end
        else begin
          j := n;
        end;
      end;
    end;
  end;
  for i := 1 to n do begin
    if s[i] <> 'G' then begin
      write(s[i]);
    end;
  end;
end.

var
s:string;
n,a,b:longint;
begin
readln(n);
readln(s);
a:=1;
while a <> 0 do
begin
a:=pos('ogo',s);
if (a > 0) then begin n:=n-3;
delete(s,a,3);
insert('***',s,a);
end;
b:=1;
while b <> 0 do begin
b:=pos('*go',s);
if b > 0 then begin delete(s,b+1,2); n:=n-2; end;
end;
end;
writeln(s);
end.

var
n,i:integer;
s:string;

begin
readln(n);
readln(s);
s:=s+' '+' ';
for i:=1 to n-2 do
if (s[i]='o') and (s[i+1]='g')and(s[i+2]='o') then
begin
delete(s,i,1);
while  (s[i]='g') and (s[i+1]='o') do
delete(s,i,2);
insert('***',s,i);
end;
writeln(s);
end.

var s:string;
    n,vt,i:byte;
    a:array[1..100] of string;
begin
  readln(n);readln(s);a[1]:='ogo';
  For i:=2 to 100 do a[i]:=a[i-1]+'go';
  For i:=100 downto 1 do
    While pos(a[i],s)>0 do
    begin
        vt:=pos(a[i],s);delete(s,vt,length(a[i]));
        insert('***',s,vt);
    end;
    writeln(s);
end.

var n, i : integer;
    temp : boolean;
    word : array [1..100] of char;

begin
    readln(n);

    for i := 1 to n do
        read(word[i]);

    i := 1;
    temp := false;
    while i <= n do
    begin
        if not(temp) then
            if (word[i] = 'o') and (word[i+1] = 'g') and (word[i+2] = 'o') then
            begin
                write('***');
                i := i + 3;
                temp := true;
            end
            else
            begin
                write(word[i]);
                i := i + 1;
            end
        else
            if (word[i] = 'g') and (word[i+1] = 'o') then
            begin
               i := i + 2;
            end
            else
                temp := false;
    end;
    writeln;
end.

var
  s : ansistring;
  f : array[0..1500] of longint;
  n,i,j,l : longint;

begin
  readln(n);
  readln(s);
  i:=1;
  while i <= n-2 do begin
    if s[i]+s[i+1]+s[i+2] = 'ogo' then begin
      l:=i;
      i:=i+3;
      while (i <= n-1) do if s[i]+s[i+1] = 'go' then i:=i+2 else break;
      dec(i);
      f[l]:=i-l+1;
    end;
    inc(i);
  end;
  i:=1;
  while i <= n do begin
    if f[i] = 0 then write(s[i]) else begin write('***'); i:=i+f[i]-1; end;
    inc(i);
  end;
  writeln;
end.

var s:string;
n,i,l,k:integer;
begin
  readln(n);
  readln(s);
  i:=1;
  i:=pos('ogo',s);
  while i<>0 do
  begin
  delete(s,i,3);
  insert('***',s,i);
  l:=length(s);
  k:=3;
  while((i+k+1)<=l) and (s[i+k]='g') and (s[i+k+1]='o') do
          begin
            delete(s,i+k,2);
            l:=l-2;
          end;
  i:=pos('ogo',s);
  end;
  write(s);
end.

var s,s1: array [1..1000] of char;
i,j,k,len: integer;
begin
readln(len);
for i:=1 to len do
read(s[i]);
s[len+1]:=' ';
s[len+2]:=' ';
i:=1;
j:=1;
while (i<=len) do begin
if (s[i]='o') then begin
if (s[i+1]='g') and (s[i+2]='o') then
begin
while ((s[i+1]='g') and (s[i+2]='o')) do begin
i:= i +2;
if (i >= len)then break;
end;
s1[j]:='*';
s1[j+1]:='*';
s1[j+2]:='*';
j:=j+3;
end else begin
s1[j]:=s[i];
inc(j);
end;
end else begin
s1[j]:=s[i];
inc(j);
end;
inc(i);
end;
for i:=1 to (j-1) do
write(s1[i]);
end.

{$mode delphi}
var  st,st1:string;
     i,j,n,k,p:integer;
begin
   readln(n); k:=1;
   read(st);
   i:=1;
   while i<=n do
      if st[i]='o' then begin
         p:=i mod 2;
         for j:=i+1 to n do begin
            if j mod 2=p then if st[j]='o' then inc(k) else break;
            if j mod 2<>p then if st[j]='g' then inc(k) else break;
         end;
         if k>2 then
              if (st[j]<>'o') and (st[j-1]='g') or (st[j]='g') and (st[j-1]='o') then      begin
                  st1:=st1+'***g'; inc(i,k); k:=1    end
                  else   begin
                  st1:=st1+'***'; inc(i,k); k:=1; end
         else begin st1:=st1+st[i]; inc(i); k:=1;   end;
      end
      else begin st1:=st1+st[i]; inc(i); end;

   write(st1);
end.

Var n:byte;
    s:string;
Function poisk(n:byte;s:string):string;
Var d:string;
    k:byte;
Begin
While Pos('ogo',s)<>0 do begin
  d:='ogo';
  while Pos(d,s)<>0 do d:=d+'go';
  Delete(d,length(d)-2,2);
  k:=Pos(d,s);
  Delete(s,k,length(d));
  Insert('***',s,k)
  end;
poisk:=s;
End;
Begin
readln(n);
readln(s);
writeln(poisk(n,s));
Readln
End.

var n,now:longint;
    s:string;
begin
  readln(n);
  readln(s);
  now:=1;
  while(now+2<=n)do
    begin
      if(s[now]<>'o')or(s[now+1]<>'g')or(s[now+2]<>'o')then begin write(s[now]);inc(now);continue;end;
      now:=now+3;write('***');
      while(now+1<=n)and(s[now]='g')and(s[now+1]='o')do begin ;now:=now+2;end;
    end;
  while(now<=n)do begin write(s[now]);inc(now);end;
  writeln;
end.

type
  mass=array of string;
var a:mass;
    n,i,j:integer;
    s:string;
begin
readln(n);
readln(s);
setLength(a, n);
for i:=0 to n-1 do
  begin;
  a[i]:=copy(s, i+1, 1);
  end;
i:=0;
while i<n-2 do
  begin
  if (a[i]='o')and(a[i+1]='g')and(a[i+2]='o') then
            begin
            a[i]:='*';
            a[i+1]:='*';
            a[i+2]:='*';
            i:=i+2;
            j:=i+1;
            if j<n-2 then
              while (a[j]='g')and(a[j+1]='o') do
                begin
               a[j]:='';
               a[j+1]:='';
               j:=j+2;
               i:=i+2;
               if j=n then
                 break;
               end;
            end;
  i:=i+1;
  end;
s:='';
for i:=0 to n-1 do
  begin
  s:=s+a[i];
  end;
writeln(s);
end.

var s,t,u,j:string;
n,x,i,o,a:integer;
begin
readln(n);
readln(s);
while n<>0 do
begin
  o:=0;
  i:=0;
  i:=pos('ogo',s);
if i>0 then begin n:=n-3; o:=1; end;
  x:=pos('ogo',s);
  delete(s,x,3);
  insert('***',s,x);
  u:=copy(s,x+2,3);
if u = '*go' then begin delete(s,x+3,2); n:=n-2; o:=1 end
else
  begin
    if o = 0 then n:=n-1;
  end;
i:=pos('ogo',s);
if i=0 then n:=0;
end;
a:=length(s);
while a<>0 do
begin
x:=pos('*go',s);
if x>0 then
delete(s,x+1,2)
else
a:=0
end;
writeln(s);
end.

var
s:string;
n,a,b:longint;
begin
readln(n);
readln(s);
a:=1;
while a<>0 do
begin
a:=pos('ogo',s);
delete(s,a,3);
insert('***',s,a);
a:=pos('*go',s);
if a <> 0 then delete(s,a+1,2);
a:=pos('ogo',s);
end;
writeln(s);
end.

var
s:string;
n,a,b:longint;
begin
readln(n);
readln(s);
while n > 0 do
begin
a:=pos('ogo',s);
b:=pos('*go',s);
if (a > 0) or (b > 0) then begin
b:=pos('*go',s);
if b > 0 then begin delete(s,b+1,2); n:=n-2; end;
a:=pos('ogo',s);
if (a > 0) then begin n:=n-3;
delete(s,a,3);
insert('***',s,a);
end;
end
else n:=n-1;
writeln(s);
end;
writeln(s);
end.

var
s:string;
n,a,b:longint;
begin
readln(n);
readln(s);
while n > 0 do
begin
a:=pos('ogo',s);
b:=pos('*go',s);
if (a > 0) or (b > 0) then begin
b:=pos('*go',s);
if b > 0 then begin delete(s,b+1,2); n:=n-2; end;
a:=pos('ogo',s);
if (a > 0) then begin n:=n-3;
delete(s,a,3);
insert('***',s,a);
end;
end
else n:=n-1;
end;
writeln(s);
end.

var
s:string;
n,a,b:longint;
begin
readln(n);
readln(s);
while n > 0 do
begin
a:=pos('ogo',s);
b:=pos('*go',s);
if (a > 0) or (b > 0) then begin
if (a > 0) then begin n:=n-3;
delete(s,a,3);
insert('***',s,a);
end;
if b > 0 then begin delete(s,b+1,2); n:=n-2; end; end
else n:=n-1;
end;
writeln(s);
end.

var s,s1:string;
    l,p:char;
    i,n,k:integer;
    begin
    readln(n);
    readln(s);

    l:='1';

    for i:=1 to n do
    s1:=s1+'0';

    i:=1;

    while(i<=n-2) do
    begin
    if(s[i]='o')and(s[i+1]='g')and(s[i+2]='o') then
    begin
    s1[i]:=l;
    s1[i+1]:=l;
    s1[i+2]:=l;
    i:=i+3;
    k:=1;
    while(k=1) do
    begin
    if(i>n-1) then
    begin
    k:=0;
    break;
    end;
    if(i<=n-1) then
    if(s[i]='g')and(s[i+1]='o') then
    begin
    s1[i]:=l;
    s1[i+1]:=l;
    i:=i+2;
    end;
    if(i<=n-1) then
    if(s[i]<>'g')or(s[i+1]<>'o') then
    begin
    l:=chr(ord(l)+1);
    k:=0;
    i:=i-1;
    break;
    end;
    end;
    end;
    i:=i+1;
    end;

    writeln(s);
    writeln(s1);

    i:=1;

    while(i<=n) do
    begin

    if(s1[i]<>'0') then
    begin
    write('***');
    p:=s1[i];
    while(i<=n)do
    begin
    if(s1[i]='0')or(s1[i]<>p) then break;
    if(s1[i]<>'0') then i:=i+1;
    end;
    end;
    if(i<=n) then
    if(s1[i]='0') then
    begin
    write(s[i]);
    i:=i+1;
    end;
    end;
    end.

var S : string;
n, i : integer;
check : Boolean;

begin
check:=false;
readln(n);
readln(S);
i:=1;
repeat
  if check
  then if ((S[i]='g') and (S[i+1]='o')) then i:=i+1 else begin write(S[i]); check:=false; end
  else
    if ((S[i]<>'o') and (S[i]<>'g'))
    then write(S[i])
    else
      if ((S[i]='o') and (S[i+1]='g') and (S[i+2]='o'))
      then begin check:=true; write('***'); i:=i+2; end
      else write(S[i]);
i:=i+1;
until i>n;
end.

var S : string;
n, i : integer;
check : Boolean;

begin
check:=false;
readln(n);
readln(S);
i:=1;
repeat
  if check
  then if ((S[i]='g') and (S[i+1]='o')) then i:=i+1 else begin write(S[i]); check:=false; end
  else
    if ((S[i]<>'o') and (S[i]<>'g'))
    then write(S[i])
    else
      if ((S[i]='o') and (S[i+1]='g') and (S[i+2]='o'))
      then begin check:=true; write('***'); i:=i+2; end;
i:=i+1;
until i>n;
end.

var
   s,p:string;
   k,i,n:longint;
begin
readln(n);
readln(s);
p:='ogo';
i:=1;
while i<=length(s) do begin
if copy(s,i,3)=p then begin
   delete(s,i,3);
   k:=i;
   if copy(s,k,2)='go' then begin
   while copy(s,k,2)='go' do
         k:=k+2;
   delete(s,i,k-2);
   end;
   insert('***',s,i);
   i:=i+3;
   end
   else i:=i+1;
end;
writeln(s);
end.

var
 n,i,j: longint;
 s,t: shortstring;
begin
 readln(n);
 readln(s);
 s:=s+'#';
 i:=1;
 while i <= n do
 begin
  if s[i] = 'o' then for j:=i to n do
  begin
   if (s[j] = 'g') and (s[j+1] <> 'o') then
   begin
    t:=t+'***';
    i:=j-1;
    break;
   end;

   if (s[j] = 'o') and (s[j+1] <> 'g') then
   begin
    t:=t+'***';
    i:=j;
    break;
   end;
  end else t:=t+s[i];

  inc(i);
 end;

 writeln(t);
end.

var t,s: ansistring;
    i,n,j: longint;

procedure xuli;
  begin
    i:=1;
    repeat
      if s[i]='o' then
        begin
          j:=i+1;
          while s[j]+s[j+1]='go' do inc(j,2);
          write('***');
          i:=j;
        end
      else
        begin write(s[i]); inc(i); end;
    until i>n;
  end;

BEGIN

  readln(n);
  readln(s);
  s:=s+'aa';
  xuli;

END.

var s:string;
n,i,j:longint;

begin

readln(n);
readln(s);
j:=1;
for i:=1 to n do
        begin
        if s[i]='o' then
                begin
                if (s[i+1]='g') and (s[i+2]='o') and (s[i+3]='g') and (s[i+4]='o') and (s[i+5]='g') and (s[i+6]='o')then
                        begin
                        delete(s,i,7);
                        insert('***',s,i);
                        end
                else
                if (s[i+1]='g') and (s[i+2]='o') and (s[i+3]='g') and (s[i+4]='o') then
                        begin
                        delete(s,i,5);
                        insert('***',s,i);
                        end
                else
                if (s[i+1]='g') and (s[i+2]='o') then
                        begin
                        delete(s,i,3);
                        insert('***',s,i);
                        end;
                end;
        if i>length(s) then break;
        end;
writeln(s);
end.

var a,s:string;
i,n,t,d:longint;

begin
readln(n);
readln(s);
a:='';
i:=1;
t:=0;d:=0;
while i<=length(s) do
        begin
        if s[i]='o' then
                begin
                if s[i+1]+s[i+2]='go' then
                        begin
                        inc(d);
                        t:=1;
                        i:=i+2;
                        end
                else
                if s[i+1]+s[i+2]<>'go' then
                        begin
                        if d<>0 then
                                begin
                                if t=1 then a:=a+'***'
                                else a:=a+'o';
                                t:=0;
                                end;
                        inc(i);
                        d:=0;
                        end;
                end;
        if i<=length(s) then
        begin
        if s[i]<>'o' then
                begin
                a:=a+s[i];
                inc(i);
                end;
        end;
        end;
writeln(a);
end.

var a,s:string;
i,n,t,d:longint;

begin
readln(n);
readln(s);
a:='';
i:=1;
t:=0;d:=0;
while i<=length(s) do
        begin
        if s[i]='o' then
                begin
                inc(d);
                if s[i+1]+s[i+2]='go' then
                        begin
                        t:=1;
                        i:=i+2;
                        end
                else
                if s[i+1]+s[i+2]<>'go' then
                        begin
                        inc(i);
                        end;
                end;
        if s[i]<>'o' then
                begin
                if d<>0 then
                        begin
                        if t=1 then a:=a+'***'
                        else a:=a+'o';
                        t:=0;
                        end;
                d:=0;
                end;
        if s[i]<>'o' then
                begin
                a:=a+s[i];
                inc(i);
                end;
        end;
writeln(a);
end.

var a,s:string;
i,n,t,d:longint;

begin
readln(n);
readln(s);
a:='';
i:=1;
t:=0;d:=0;
while i<=length(s) do
        begin
        if s[i]='o' then
                begin
                inc(d);
                if s[i+1]+s[i+2]='go' then
                        begin
                        t:=1;
                        i:=i+2;
                        end
                else
                if s[i+1]+s[i+2]<>'go' then
                        begin
                        inc(i);
                        end;
                end;
        if s[i]<>'o' then
                begin
                if d<>0 then
                        begin
                        if t=1 then a:=a+'***'
                        else a:=a+'o';
                        t:=0;
                        end;
                d:=0;
                end;
        if i<=n then
        begin
        if s[i]<>'o' then
                begin
                a:=a+s[i];
                inc(i);
                end;
        end;
        end;
writeln(a);
end.

var a,s:string;
i,n,t,d:longint;

begin
readln(n);
readln(s);
a:=' ';
i:=1;
t:=0;d:=0;
while i<=length(s) do
        begin
        if s[i]='o' then
                begin
                inc(d);
                if s[i+1]+s[i+2]='go' then
                        begin
                        t:=1;
                        i:=i+2;
                        end
                else
                if s[i+1]+s[i+2]<>'go' then
                        begin
                        inc(i);
                        end;
                end;
        if s[i]<>'o' then
                begin
                if d<>0 then
                        begin
                        if t=1 then a:=a+'***'
                        else a:=a+'o';
                        t:=0;
                        end;
                d:=0;
                end;
        if s[i]<>'o' then
                begin
                a:=a+s[i];
                inc(i);
                end;
        end;
writeln(a);
end.

program ZadachaA;
var x,y,z:integer;
    n:integer;
    s,s1:string;
Begin
  Readln(n);
  Readln(s);
  for x:=1 to n do
    Begin
      y:=y+1;
      if (y>n-2) and (z=0) then
      Begin
        if (y=n) then s1:=s1+s[y];
        if (y=n-1) then s1:=s1+s[y]+s[y]+s[y+1];
        break;
      end;
      if z<>0 then
        Begin
          if y=n then
            Begin
              s1:=s1+s[y];
              break;
            end;
          if (s[y]='g') and (s[y+1]='o') then
            Begin
              y:=y+1;
            end
          else
            Begin
              if (y>n-2) and (z=0) then
                Begin
                  if (y=n) then s1:=s1+s[y];
                  if (y=n-1) then s1:=s1+s[y]+s[y]+s[y+1];
                  break;
                end;
              if (s[y]='o') and (s[y+1]='g') and (s[y+2]='o') then
                Begin
                  y:=y+2;
                  z:=1;
                  s1:=s1+'***';
                end
              else
                Begin
                  s1:=s1+s[y];
                  z:=0;
                end;
            end;
        end
      else
        Begin
          if (s[y]='o') and (s[y+1]='g') and (s[y+2]='o') then
          Begin
            y:=y+2;
            z:=1;
            s1:=s1+'***';
          end
          else s1:=s1+s[y];
        end;
      if (y=n) then break;
    end;
  Write(s1);
end.

var s:string;
    n,i,j,a,b:longint;
begin
  readln(n);
  readln(s);
  j:=-1;
  s:=s+'1';
  while i <= n do
    begin
      if (s[i]='o') and (s[i+1]='g') and (s[i+2]='o') then
        begin s[i]:='*';s[i+1]:='*';s[i+2]:='*'; inc(i,2);  writeln(i);
          while (s[i+1]='g') and (s[i+2]='o') do delete(s,i+1,2);end;
      inc(i);

    end;

    delete(s,length(s),1);
writeln(s);end.

Const fi='';//phongvan.inp
      fo='';
      dem='ogo';
      og='go';
      thaythe='***';
Var s:string;
    n:integer;
    f,g:text;
Procedure Openfile;
Begin
 Assign(f,fi);reset(f);
 Assign(g,fo);rewrite(g);
End;

Procedure Input;
Begin
 Readln(f,n);
 Readln(f,s);
End;

Procedure Process;
Var i,d,cd:integer;
    sp:string;
    ok:boolean;
Begin
 While pos(dem,s)<>0 do
  Begin
   sp:='';
   d:=pos(dem,s);
   delete(s,d,3);
   Insert(thaythe,s,d);
   OK:=true;
   d:=d+2;
   While OK=True do
    Begin
     Inc(d);
     if d+1>length(s) then break;
     sp:=sp+s[d];
     If length(sp)=2 then
      If sp=og then
       Begin
        sp:='';
        delete(s,d-1,2);
        d:=d-2;
       End
        else OK:=false;
    End;
   {For i:=d+3 to n do
    Begin
     If length(sp)=2 then
      Begin
       If sp<>og then
        Begin
         delete(s,d+3,cd);
         break;
        End
        else
        Begin
         cd:=cd+2;
         sp:='';
         sp:=sp+s[i];
        End
      End else sp:=sp+s[i];
    End; }
  End;
End;

Procedure Output;
Begin
 Write(g,s);
End;

Procedure Closefile;
Begin
 Close(f);
 Close(g);
End;

BEGIN
 Openfile;
 Input;
 Process;
 Output;
 Closefile;
END.

{$mode delphi}
var  st,st1:string;
     i,j,n,k,p:integer;
begin
   readln(n); k:=1;
   read(st);
   i:=1;
   while i<=n do
      if st[i]='o' then begin
         p:=i mod 2;
         for j:=i+1 to n do begin
            if j mod 2=p then if st[j]='o' then inc(k) else break;
            if j mod 2<>p then if st[j]='g' then inc(k) else break;
         end;
         if k>2 then
              if (st[j]<>'o') and (st[j-1]='g') then      begin
                  st1:=st1+'***g'; inc(i,k); k:=1    end
                  else   begin
                  st1:=st1+'***'; inc(i,k); k:=1; end
         else begin st1:=st1+st[i]; inc(i); k:=1;   end;
      end
      else begin st1:=st1+st[i]; inc(i); end;

   write(st1);
end.

var
  s, b, ans, l: string;
  n, i, q, cnt: longint;
begin
  readln(n);
  readln(s);
  ans := '';
  i := 3;
  while i <= n do
  begin
    l := s[i - 2] + s[i - 1] + s[i];
    if (l = 'ogo') then
    begin
      cnt := 0;
      if i + 2 <= n then
      begin
        q := i + 2;
        while (q <= n) and (s[q - 1] + s[q] = 'go') do
        begin
          q := q + 2;
          inc(cnt);
        end;
        if (cnt <> 0) then
        begin
            i := q - 2;
        end;
      end;
      if cnt = 0 then
        i := i + 2;
      ans := ans + '***';
    end
    else
    begin
      if i <= n - 2 then
        ans := ans + s[i - 2]
      else
        ans := ans + s[i];
    end;
    inc(i);
  end;
  writeln(ans);
end.

var s:string;
n,i,k:integer;
begin
readln(n);
readln(s);
i:=1;
k:=1;
while i<(n-3) do begin
if (s[i]='o') and (s[i+1]='g') and (s[i+2]='o') then begin
s[i]:='*';
s[i+1]:='*';
s[i+2]:='*';
for k:=1 to n do
if (i+1+2)<=length(s)then begin
if (s[i+1+2]='g') and (s[i+2+2]='o') then begin
delete(s,i+1+2,2);end;end
else break;
i:=i+3;
end
else i:=i+1;
end;
writeln(s);
end.

var s:string;
n,i,j,k:integer;
begin
readln(n);
readln(s);
i:=1;
k:=1;
while i<(n-1) do begin
if (s[i]='o') and (s[i+1]='g') and (s[i+2]='o') then begin
s[i]:='*';
s[i+1]:='*';
s[i+2]:='*';
for k:=1 to 10 do
if (i+1+2*k)<n then
if (s[i+1+2*k]='g') and (s[i+2+2*k]='o') then
delete(s,i+1+2*k,2)
else break;
i:=i+3;
end
else i:=i+1;
end;
writeln(s);
end.

program interview;
const fi='';
      fo='';
var f,g:text;
    s,m:ansistring;
    n:Longint;
procedure open_file;
begin
    assign(f,fi);
    reset(f);
    assign(g,fo);
    rewrite(g);
end;
procedure close_file;
begin
    close(f);
    close(g);
end;
procedure write_in;
begin
    readln(f,n);
    readln(f,s);
end;
procedure process;
var i,j,d:longint;
    x,y:char;
begin
    s:=s+'###';
    i:=1;
    while i<=n do
     begin
      j:=i;
      if s[j]<>'g' then
      while (s[j]<>'o') and (j<=n) do
       inc(j);
      if (s[j+1]='g') and (s[j+2]='o') then
       begin
         s[j]:='*';
         x:=s[j+1];
         s[j+1]:='*';
         y:=s[j+2];
         s[j+2]:='*';
         j:=j+3;
       end
      else
      if  (s[j]='g') and (s[j+1]='o') then
         delete(s,j,2)
      else j:=j+1;
      n:=length(s)-3;
      i:=j
     end;
    i:=length(s);
    while (i>=1) and (s[i]='#') do
     begin
      delete(s,i,1);
      i:=length(s);
     end;
    writeln(g,s);
end;
begin

   open_file;
   write_in;
   process;
   close_file;
end.

program interview;
const fi='';
      fo='';
var f,g:text;
    s,m:ansistring;
    n:Longint;
procedure open_file;
begin
    assign(f,fi);
    reset(f);
    assign(g,fo);
    rewrite(g);
end;
procedure close_file;
begin
    close(f);
    close(g);
end;
procedure write_in;
begin
    readln(f,n);
    readln(f,s);
end;
procedure process;
var i,j:longint;
    x,y:char;
begin
    s:=s+'   ';
    i:=1;
    while i<=n do
     begin
      j:=i;
      while (s[j]<>'o') and (j<=n) do
       inc(j);
      if (s[j+1]='g') and (s[j+2]='o') then
       begin
         x:=s[j];
         s[j]:='*';
         y:=s[j+1];
         s[j+1]:='*';
         j:=j+2;
       end
      else
       if (s[j]='o') then
       if (s[j+1]<>'g') or (s[j+2]<>'o') then
       if (x='o') and (y='g') then
        begin
         x:=y;
         y:='o';
         s[j]:='*';
         j:=j+1;
        end
       else
         j:=j+1;
      i:=j;
     end;
    i:=length(s);
    while (i>=1) and (s[i]=' ') do
     begin
      delete(s,i,1);
      i:=length(s);
     end;
    writeln(g,s);
end;
begin
   open_file;
   write_in;
   process;
   close_file;
end.

program interview;
const fi='';
      fo='';
var f,g:text;
    s,m:ansistring;
    n:Longint;
procedure open_file;
begin
    assign(f,fi);
    reset(f);
    assign(g,fo);
    rewrite(g);
end;
procedure close_file;
begin
    close(f);
    close(g);
end;
procedure write_in;
begin
    readln(f,n);
    readln(f,s);
end;
procedure process;
var i,j,d:longint;
    x,y:char;
begin
    s:=s+'###';
    i:=1;
    while i<=n do
     begin
      j:=i;
      if s[j]<>'g' then
      while (s[j]<>'o') and (j<=n) do
       inc(j);
      if (s[j+1]='g') and (s[j+2]='o') then
       begin
         s[j]:='*';
         x:=s[j+1];
         s[j+1]:='*';
         y:=s[j+2];
         s[j+2]:='*';
         j:=j+3;
       end
      else
      if  (s[j]='g') and (s[j+1]='o') and (y='o') then
         delete(s,j,2)
      else j:=j+1;
      n:=length(s)-3;
      i:=j
     end;
    i:=length(s);
    while (i>=1) and (s[i]='#') do
     begin
      delete(s,i,1);
      i:=length(s);
     end;
    writeln(g,s);
end;
begin

   open_file;
   write_in;
   process;
   close_file;
end.

program interview;
const fi='';
      fo='';
var f,g:text;
    s,m:ansistring;
    n:Longint;
procedure open_file;
begin
    assign(f,fi);
    reset(f);
    assign(g,fo);
    rewrite(g);
end;
procedure close_file;
begin
    close(f);
    close(g);
end;
procedure write_in;
begin
    readln(f,n);
    readln(f,s);
end;
procedure process;
var i,j,d:longint;
    x,y:char;
begin
    s:=s+'###';
    i:=1;
    while i<=n do
     begin
      j:=i;
      if s[j]<>'g' then
      while (s[j]<>'o') and (j<=n) do
       inc(j);
      if (s[j]='o') and (s[j+1]='g') and (s[j+2]='o') then
       begin
         s[j]:='*';
         x:=s[j+1];
         s[j+1]:='*';
         y:=s[j+2];
         s[j+2]:='*';
         j:=j+3;
       end
      else
      if  (s[j]='g') and (s[j+1]='o') and (y='o') then
         delete(s,j,2)
      else j:=j+1;
      n:=length(s)-3;
      i:=j
     end;
    i:=length(s);
    while (i>=1) and (s[i]='#') do
     begin
      delete(s,i,1);
      i:=length(s);
     end;
    writeln(g,s);
end;
begin

   open_file;
   write_in;
   process;
   close_file;
end.

var
s,s1:string;
k,i,n:integer;
ch:char;
begin
readln(n);
for i:=1 to n do
 begin
 read(ch);
  s:=s+ch;
  end;
s:=s+'0000';
while pos('ogo',s) <> 0 do begin
k:=pos('ogo',s);
s1:='';
s1:=s1+'ogo';
  if k < n-2 then begin
    i:=k+3;
    while (s[i]+s[i+1] = 'go')  do
      if s[i]+s[i+1] = 'go' then begin
        s1:=s1+'go';
        i:=i+2;
        end;

  end;
  writeln(s1);
  delete(s,k,length(s1));
  insert('***',s,k);
  end;
delete(s,length(s)-3,4);
writeln(s);
end.

var
s,s1:string;
k,i,n:integer;
ch:char;
begin
readln(n);
readln(s);
s:=s+'0000';
while pos('ogo',s) <> 0 do begin
k:=pos('ogo',s);
s1:='';
s1:=s1+'ogo';
  if k < n-2 then begin
    i:=k+3;
    while (s[i]+s[i+1] = 'go')  do
      if s[i]+s[i+1] = 'go' then begin
        s1:=s1+'go';
        i:=i+2;
        end;

  end;
  writeln(s1);
  delete(s,k,length(s1));
  insert('***',s,k);
  end;
delete(s,length(s)-3,4);
writeln(s);
end.

var
s,s1:string;
k,i,n:integer;
ch:char;
begin
readln(n);
for i:=1 to n do
 begin
 read(ch);
  s:=s+ch;
  end;
s:=s+'0000';
while pos('ogo',s) <> 0 do begin
k:=pos('ogo',s);
s1:='';
s1:=s1+'ogo';
  if k < n-2 then begin
    i:=k+3;
    while (s[i]+s[i+1] = 'go') or (s[i]+s[i+1]+s[i+2] = 'ogo' ) do
      if s[i]+s[i+1] = 'go' then begin
        s1:=s1+'go';
        i:=i+2;
        end
     else begin
     s1:=s1+'ogo';
     i:=i+3;
     end;
  end;
  writeln(s1);
  delete(s,k,length(s1));
  insert('***',s,k);
  end;
delete(s,length(s)-3,4);
writeln(s);
end.

var
  q, s: string;
  n, j, i: integer;

begin
  readln(n);
  readln(s);
  q := 'ogo';
  for i := 1 to (n - 3) div 2 do
  begin
    q := q + 'go'
  end;
  while length(q) >= 3 do
  begin
    while pos(q, s) <> 0 do
    begin
      j := pos(q, s);
      delete(s, j, length(q));
      insert('***', s, j);
    end;
    delete(q,length(q),2);
  end;
writeln(s);
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  s, s1 : string;
  p, n,i : integer;

begin
  readln(n);
  readln(s);
  p := pos('ogo', s);

  repeat
    p := pos('ogo', s);
    if p = 0 then break;
    s[p] := '*';
    s[p+1] := '*';
    s[p+2] := '*';
    i := p+3;
    s1 := Copy(s,i,2);
    while s1 = 'go' do begin

      s[i] := '*';
      s[i+1] := '*';
      i := i + 2;
      s1 := Copy(s,i,2);
      end;
   until p=0;
    writeln(s);

end.

var i,j,n,c:integer;
A:array[1..110] of char;
begin
readln(N);
for i:=1 to N do
read(A[i]);
j:=1;
while j<=N do
begin
c:=0;
if (A[j]='o') and (A[j+1]='g') and (A[j+2]='o') then
begin
A[j]:='*';
A[j+1]:='*';
A[j+2]:='*';
j:=j+3;
c:=1;
while (A[j]='g') and (A[j+1]='o') and (j-1<=N) do
begin
A[j]:=chr(13);
A[j+1]:=chr(13);
j:=j+2;
end;
end;
if c=0 then
j:=j+1;
end;

for i:=1 to N do
write(A[i]);
end.

var //f,g:text;
    n:longint;
    s,s1:ansistring;
{procedure openfile;
begin
  assign(f,fi);
  reset(f);
  assign(g,fo);
  rewrite(g);
end;
procedure closefile;
begin
  close(f);
  close(g);
end;}
procedure nhap;
begin
  readln({f,}n);
  readln({f,}s);
end;
procedure process;
var i,j:longint;
begin
  i:=1;  s1:='';
  while i<=n do
    begin
      j:=i;
      if s[i]='o' then
        begin
          while (j<=n-2)and(s[j]='o')and(s[j+1]='g')and(s[j+2]='o') do j:=j+2;
          s1:=s1+'***';
        end
      else s1:=s1+s[i];
      i:=j+1;
    end;
  write({g,}s1);
end;
begin
 // openfile;
  nhap;
  process;
  //closefile;
end.

program oge202;
var k,n,i,j :integer;
s,o:string;
begin
readln(n);
readln(s);
o:='';
while pos('ogo',s)<>0 do
 begin
 k:=0;
 i:=pos('ogo',s);
 delete(s,i,3);
 insert('***',s,i);
 while copy(s,i+3,2)='go' do
  begin
  delete(s,i+3,2);
  k:=k+1;
  end;
  for j:=1 to k do
  insert('**',s,i+3);
 end;
 writeln(s);
end.

program oge202;
var k,n,i,j :integer;
s,o:string;
begin
readln(n);
readln(s);
o:='';
while pos('ogo',s)<>0 do
 begin
 k:=0;
 i:=pos('ogo',s);
 delete(s,i,3);
 insert('***',s,i);
 while copy(s,i+3,2)='go' do
  begin
  delete(s,i+3,2);
  k:=k+1;
  end;
  for j:=1 to k do
  insert('**',s,i+3);
 end;
 writeln(s);
 readln();
end.

var s:string;
    i,p,n:integer;
    flag:boolean;
begin
  readln(n);
  readln(s);
  p:=pos('o', s);
  while(p<>0) do
  begin
    i:=p+1;
    flag:=true;
    while flag and (i<length(s)) do
      begin
          if(s[i]='g') and (s[i+1]='o') then
            inc(i,2)
          else
            flag:=false;
      end;
      delete(s,p,i-p);
      insert('***',s,p);
      i:=p+3;
      p:=pos('o', s);
  end;
  writeln(s);

end.

var st : string;
	i, n, t :longint;
begin
	read(st);
	st := st + '##';
	while pos('ogo', st) > 0 do
	begin
		t := pos('ogo', st);
		while ((st[t + 3] = 'g') and (st[t + 4] = 'o')) do
			delete (st, t + 3, 2);
		t := pos('ogo', st);
		delete(st, t, 3);
		insert('***', st, t);
	end;
	delete(st, length(st) - 1, 2);
	write(st);
end.

var
  i, n, count: longint;
  c: string;
  f: boolean;

begin
  readln(n);
  read(c);
  c := c + '                                    ';
  for i := 1 to n do
  begin
    if c[i] = 'o' then if c[i] = 'g' then if c[i] = 'o' then begin
          inc(count, 3);
          f := true;
          while ((c[i] = 'g') and (c[i + 1] = 'o')) do
            inc(count, 2);
          if f = true then begin
            write('**');
            f := false;
          end
          else write(c[i]);
        end;
  end;
end.

program a;
var s,s1:String;
i,j,p,n:integer;
ready:boolean;
begin
readln(n);
readln(s);
for i:=1 to length(s)-2 do
if(copy(s,i,3)='ogo') then begin
ready:=false;
j:=i+3;
while(ready=false) do begin
s1:=copy(s,j,2);
if s1<>'go' then
ready:=true
else
j:=j+2;
end;
delete(s,i,j-i);
s1:='*';
for p:=i to j-1 do
insert(s1,s,p);
end;
writeln(s);
end.

var
s: string;

procedure cut(i: integer);
var
 j:integer;
begin
 s[i]:='*';
 s[i+1]:='*';
 s[i+2]:='*';
 for j:=i+3 to length(s)-1 do
 begin
  if (s[j]='g')and(s[j+1]='o') then
  begin
   s[j]:='*';
   s[j+1]:='*';
   if (j+2<length(s))and(not(s[j+2]='g'))then break;
  end;
  if not((s[j]='*') or (s[j]='g'))then break;
 end;
end;

var
 i,c: integer;
begin
 readln(c);
 readln(s);
 for i:=1 to length(s)-2 do
  if (s[i]='o')and(s[i+1]='g')and(s[i+2]='o') then cut(i);
 c:=0;
 for i:=1 to length(s) do
 begin
  if s[i]='*' then inc(c)
  else c:=0;
  if c<4 then write(s[i]);
 end;
end.

var
 s,c: string;
 p: integer;
begin
 readln(p);
 readln(s);
 c:='ogo';
 while length(c)+2<length(s) do
 begin
  c:=c+'go'
 end;
 writeln(c);
 while length(c)>2 do
 begin
  writeln('c: ',c);
  while pos(c,s)>0 do
  begin
   p:=pos(c,s);
   delete(s,p,length(c));
   insert('***',s,p);
   writeln('s: ',s);
  end;
  delete(c,length(c)-1,2);
 end;
 writeln(s);
end.

var
s: string;

procedure cut(i: integer);
var
 j:integer;
begin
 s[i]:='*';
 s[i+1]:='*';
 s[i+2]:='*';
 for j:=i+3 to length(s)-1 do
 begin
  if (s[j]='g')and(s[j+1]='o') then
  begin
   s[j]:='*';
   s[j+1]:='*';
   if (j+2<length(s))and(not(s[j+2]='g'))then break;
  end;
  if not((s[j]='*') or (s[j]='g'))then break;
 end;
end;

var
 i,c: integer;
begin
 readln(s);
 for i:=1 to length(s)-2 do
  if (s[i]='o')and(s[i+1]='g')and(s[i+2]='o') then cut(i);
 c:=0;
 for i:=1 to length(s) do
 begin
  if s[i]='*' then inc(c)
  else c:=0;
  if c<4 then write(s[i]);
 end;
end.

program project1;

var
  s, r: string;
  i,p, n,z: integer;

  label 1;
begin
  readln(n);
  readln(s);

  i := 1;
  r:='go';
   z:=Pos(r,s);

    1: while not (s[i]='o') do
      i:=i+1;
    p:=i;

    if (i+1=z) then
    while (s[p]='g') and (s[p+1]='o') or (s[p]='o') do  delete(s,p,1);
     z:=Pos(r,s)+3;
    insert('***',s,p);
    if p+3<n then goto 1;
    delete(s,length(s)-2,4);

  writeln(s);
readln;
end.

program project1;

var
  s, r: string;
  i,p, n,z: integer;

  label 1;
begin
  readln(n);
  readln(s);

  i := 1;
  r:='go';
   z:=Pos(r,s);

    1: while not (s[i]='o') do
      i:=i+1;
    p:=i;

    if (i+1=z) then
    while (s[p]='g') and (s[p+1]='o') or (s[p]='o') do  delete(s,p,1);
     z:=Pos(r,s)+3;
    insert('***',s,p);
    if p+3<n then goto 1;
    delete(s,length(s)-2,4);

  writeln(s);

end.

var s,t:string;
    dl,i,j,kek,mem:integer;
begin
    readln(t);
    dl:=1;
    kek:=0;
    if (length(t)=1) or (length(t)=2) then writeln('NO')
    else begin
    i:=2;
    while (i<length(t)) and (kek=0) do begin
        mem:=i;
        s:='';
        dl:=dl+1;
        if t[i]=t[1] then begin
          j:=1;
          while (i<=length(t)) and (t[i]=t[j]) do begin
                s:=s+t[i];
                i:=i+1;
                j:=j+1;
          end;
        end;
          if (i>length(t)) and (t[i-1]=t[j-1]) and (copy(t,1,mem-1)<>copy(t,mem,length(t)-mem+1)) then kek:=1
          else i:=mem+1;
        end;

     if kek=1 then begin
     writeln('YES');
     writeln(s);
     end
     else writeln('NO');
     end;
end.

var n,i,j:integer;
    a:array [1..100] of string;
s:string;
l:char;
begin
    readln(n);
    s:='';
    for i:=1 to n do begin
        read(l);
        s:=s+l;
    end;
    i:=1;
    while i<=length(s) do begin
          j:=i;
          if (s[j]='o') and (s[j+1]='g') and (s[j+2]='o') then begin
             a[j]:='*';
             a[j+1]:='*';
             a[j+2]:='*';
          end
          else
            if a[j]<>'*' then a[j]:=s[j];
          i:=i+1;

    end;
    for i:=1 to n do write(a[i]);
end.

                      const eps=0.0000000001;  besk1=200000008;  nnn=4600000;
            besk=80000000000000000;
              modul={1000000007}{998244353}100;

   label 22,1,2,3,4,33;
    type    real=extended;   double=extended;
    mas=array [-300000..nnn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3,p4 :int64;end; zap1=^zap;
    mass=array[-10000..nnn] of longint;mass1=^mass;
    matr=array[-10..200,-10..200] of int64;
    matr1=^matr;
    var oldq,ll,rr,maskk,otmin,otmax,izb,kol,oldpp,t,pos1,pos2,r,razm,kollad,leftx,rightx,lefty,righty,num,dirx,diry,oldii,obr,koludal,maxdl,mindl,tmin,aaa,bbb,ccc,kolst,kollek,aa,bb,t1,t2,kolx,koly,ans,ans2,dl,posleft,posright,n,xxx,yyy,dx,dy,m,w,h,jjj,l,cc,mnog,nn,t3,t4,t5,t6,posmax,tmax,kold,kk,j2,ttt,ppp,pmin,pmax,limit,posi,posj,diam,oldt,ot1,time,pos,posx,posy,dloch,newdl,oldn,oldm,ost,ot,p1,p2,p3,p4,znamzz,kolperiod,znam,tperiod,start,finish,kol1,kol2,lavel,p0,jj,ii,ogr,q,p,pp,tt,oldtt,qq,qq1,qq2,q1,q2,imax,nm,smin,cen:int64;
   istart,jstart,ifinish,jfinish,k,i2,i3,step2,k1,k2,pp0,mask,i1,j1,step1, step, i,j:longint;
   zagr,xx,yy,kolizm,test,zz,predok,hesh,yold,x1,x0,d,b,a,zsum,y,x,z:array[-200000..1535002] of int64;
    otmat,amat,bmat,cmat:matr;
    zan1,zan2:array[-1000..200000,-2..26] of boolean;
    marked1,marked2:array[-2000..2000000] of boolean;
   gr1,gr2,gr:array[-1..2000,-1..2000] of boolean;
    dd,ddr:array[-1..1502,-1..1502] of int64;
    prob1,prob2,prob3,pr1new,pr2new,pr3new,pr1,pr2,pr3:zap;
    iii,oldpos,finot,vv,znak:int64;
    aold:mas;  anss:zap;
    sss,ss,ss1,ss2:string;
    newstr,str:array[-1000..200000] of string;
    lll,rrr,v,dist,alpha,phi:extended;
    masmatr:array[-1..101,-1..101,-1..101] of int64;
    zzz,ddnew,koef,polex,ddsum,ddl:array[-1..4,-1..1300000] of int64;
    str1,str2,dpos,sum,ppos,mma,ma:array[-1000..200005,-1..30] of int64;
    xleft,xright,xplus,xminus,px,py,xc,yc,xxc,yyc:extended;
    del:array[-1..100001,-1..20] of longint;
    z0,y1,z1,z2,kolnul,fact,next,prev,s,name,dnew, voltay,c,day:mas;
    zzzz:array[0..125000000] of byte;
    aaaa,bbbb,x2:extended;
    delit:array[0..100000,0..20] of longint;
    pole:array[-10..2002,-10..2005] of char;
    ddd,matrr,ppole,dd3,dd4:array[-10..2000,-10..2200] of int64;
    ddnnew:array[-1..12,-1..12,0..200,0..3] of int64;
   newzan,marked,zanx,zany:array[-1000000..2000000] of boolean;
    ssold,sss1,sss2:string;
    def,stepen,koled,och,newoch,place,newnabor,stoim,nabor:array[-10..500005] of int64;
     zanleft,zanright,zan,fl:array[-100000..10000000] of boolean;
     dost:array[-1..210,-1..210,0..3,0..3] of int64;
    sss12:string;ch,ch1,ch2:char;
    pr,heshh,numright,dr: array [-10..206,-1..16] of int64;
    s3,s2,s1:array[-100..500000] of string;

    grr :array [-10..2010,-10..2010] of extended;
    maxpr:array[0..nnn] of string;
     tx,ty,vel,ott,v0,v1,s0,t0:int64;
     zv:point;
     left,right,ugol,rot,temp,sumtemp,vol,newx,newy:array[-1000..400000] of int64;
     mash,sqx,sqy,ottt:extended;
     xxxx,yyyy,yot:double;
       flag2,flag,flag1:boolean;

  function max(a,b:int64):int64;
begin max:=a; if b>a then max:=b;   end;

  function min(a,b:int64):int64;
begin min:=a; if b<a then min:=b;   end;

procedure udal(p:longint);
begin  next[prev[p]]:=next[p]; prev[next[p]]:=prev[p]; end;

      function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

     function summ(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p2+xx.p2*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=t1 div tt mod modul;
    t2:=t2 div tt mod modul;
    ott.p1:=t1; ott.p2:=t2;

   summ:=@ott;
 end;

     function prod(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=(t1 div tt) mod modul;
    t2:=(t2 div tt) mod modul;
    ott.p1:=t1; ott.p2:=t2;

   prod:=@ott;
 end;

    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p{/pi*180};
 end;

function degg(a,k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=degg(a,k-1)*a mod modul else
   begin  p:=degg(a,k shr 1); degg:=p*p mod modul;   end;

end;

function prost(tt:int64):boolean;
var aa:extended; i,p,t:longint;  fl:boolean;
 begin
   fl:=true;
   aa:=tt;
   aa:=sqrt(aa);
   t:=round(aa);
   for i:=2 to t do if tt mod i=0 then begin fl:=false; break; end;

   prost:=fl;
 end;

function arcsin(pp:extended):extended;
var tt:extended;
begin
   if (abs(pp)<=1+eps)and (abs(pp)>=1-eps)
   then if pp>0 then arcsin:=pi/2 else arcsin:=-pi/2;
   tt:=1-pp*pp;
   if abs(tt)>=0 then
     begin
        arcsin:=arctan(pp/sqrt(tt));

     end;

end;

function gl(ch:char):boolean;
begin
 if (ch='o')or (ch='a')or(ch='e')or(ch='u')or(ch='i') then gl:=true else gl:=false;

end;

function zaprmin(left,right:longint):int64;
begin
   if left>=right then zaprmin:=y[left] else
     begin
        if not odd(left) and odd(right) then zaprmin:=zaprmin(left shr 1,right shr 1) else
         begin
          if odd(left) then zaprmin:=min(zaprmin(left+1,right),y[left]);
          if not odd(right) then zaprmin:=min(zaprmin(left,right-1),y[right]);

         end;

     end;

end;

 function ff(gr:int64):boolean;

var ot,aa,bb,cc:int64; fl:boolean;
begin
  aa:=1; bb:=m;  cc:=aa; fl:=false;
  while abs(aa-bb)>1 do
    begin
       cc:=(aa+bb) shr 1;
       if y[cc]<gr then aa:=cc else bb:=cc;

    end;
   writeln(' cc= ',cc);
   cc:=min(cc+3,m+1);
   repeat dec(cc) until y[cc]<=gr;
   if y[cc]=gr then fl:=true else fl:=false;
  ff:=fl;
end;

function ogo(ll,rr:longint):boolean;
var i,j,k:longint; fl:boolean;

begin
  fl:=true;
  for i:=ll to rr do if (odd(i-ll) and (ss[i]<>'g'))or ((not odd(i-ll)) and (ss[i]<>'o')) then fl:=false;
  if ss[rr]<>'o' then fl:=false;
 ogo:=fl;
end;

function maxogo(ll,rr:longint):boolean;
var i,j:longint; fl:boolean;
begin
   fl:=ogo(ll,rr);
   if ogo(ll-2,rr) or ogo(ll,rr+2) then fl:=false;
   if rr-ll<2 then fl:=false;
   maxogo:=fl;
end;

begin
   { assign (input,'D:\Projects\input.txt');reset(input);
      assign (output,'D:\Projects\output.txt'); rewrite(output);
    }

      readln(n);
      readln(ss);
     { writeln(ss);
     } for i:=1 to n do for j:=i to n do if maxogo(i,j) then begin inc(q); x[q]:=i;y[q]:=j; end;
       zan[n+1]:=true;
     {  for i:=1 to q do writeln(x[i],' ',y[i]);
     }  for i:=1 to q do for j:=x[i] to y[i]-1 do zan[j]:=true;
       for i:=1 to n do if not zan[i] and not zan[i+1] then write(ss[i]) else if (zan[i] and not zan[i-1]) then write('***');

     goto 1;

     readln(p,t);
     q:=1;
     x[1]:=p;
     ll:=q;
     rr:=q;
     for step:=1 to 30 do
       begin
          for i:=ll to rr do if 2*x[i]<2000000000 then begin inc(q); x[q]:=2*x[i]; y[q]:=i;  end;
          for i:=ll to rr do if 10*x[i]+1<2000000000 then begin inc(q); x[q]:=10*x[i]+1; y[q]:=i; end;
          ll:=rr+1; rr:=q;

       end;

      writeln('q= ',q);
      for i:=1 to q do write(x[i],' '); writeln;

      for i:=1 to q do if x[i]=t then begin flag:=true; ii:=y[i];  end;
      if not flag then writeln('NO');

      while (y[ii]<>1)and(tt<100) do begin inc(tt); z[tt]:=y[ii]; ii:=y[ii];   end;

     writeln('tt= ',tt);
    { for i:=1 to tt do write(x[])
     }

1:             close(output);
end.

                      const eps=0.0000000001;  besk1=200000008;  nnn=4600000;
            besk=80000000000000000;
              modul={1000000007}{998244353}100;

   label 22,1,2,3,4,33;
    type    real=extended;   double=extended;
    mas=array [-300000..nnn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3,p4 :int64;end; zap1=^zap;
    mass=array[-10000..nnn] of longint;mass1=^mass;
    matr=array[-10..200,-10..200] of int64;
    matr1=^matr;
    var oldq,ll,rr,maskk,otmin,otmax,izb,kol,oldpp,t,pos1,pos2,r,razm,kollad,leftx,rightx,lefty,righty,num,dirx,diry,oldii,obr,koludal,maxdl,mindl,tmin,aaa,bbb,ccc,kolst,kollek,aa,bb,t1,t2,kolx,koly,ans,ans2,dl,posleft,posright,n,xxx,yyy,dx,dy,m,w,h,jjj,l,cc,mnog,nn,t3,t4,t5,t6,posmax,tmax,kold,kk,j2,ttt,ppp,pmin,pmax,limit,posi,posj,diam,oldt,ot1,time,pos,posx,posy,dloch,newdl,oldn,oldm,ost,ot,p1,p2,p3,p4,znamzz,kolperiod,znam,tperiod,start,finish,kol1,kol2,lavel,p0,jj,ii,ogr,q,p,pp,tt,oldtt,qq,qq1,qq2,q1,q2,imax,nm,smin,cen:int64;
   istart,jstart,ifinish,jfinish,k,i2,i3,step2,k1,k2,pp0,mask,i1,j1,step1, step, i,j:longint;
   zagr,xx,yy,kolizm,test,zz,predok,hesh,yold,x1,x0,d,b,a,zsum,y,x,z:array[-200000..1535002] of int64;
    otmat,amat,bmat,cmat:matr;
    zan1,zan2:array[-1000..200000,-2..26] of boolean;
    marked1,marked2:array[-2000..2000000] of boolean;
   gr1,gr2,gr:array[-1..2000,-1..2000] of boolean;
    dd,ddr:array[-1..1502,-1..1502] of int64;
    prob1,prob2,prob3,pr1new,pr2new,pr3new,pr1,pr2,pr3:zap;
    iii,oldpos,finot,vv,znak:int64;
    aold:mas;  anss:zap;
    sss,ss,ss1,ss2:string;
    newstr,str:array[-1000..200000] of string;
    lll,rrr,v,dist,alpha,phi:extended;
    masmatr:array[-1..101,-1..101,-1..101] of int64;
    zzz,ddnew,koef,polex,ddsum,ddl:array[-1..4,-1..1300000] of int64;
    str1,str2,dpos,sum,ppos,mma,ma:array[-1000..200005,-1..30] of int64;
    xleft,xright,xplus,xminus,px,py,xc,yc,xxc,yyc:extended;
    del:array[-1..100001,-1..20] of longint;
    z0,y1,z1,z2,kolnul,fact,next,prev,s,name,dnew, voltay,c,day:mas;
    zzzz:array[0..125000000] of byte;
    aaaa,bbbb,x2:extended;
    delit:array[0..100000,0..20] of longint;
    pole:array[-10..2002,-10..2005] of char;
    ddd,matrr,ppole,dd3,dd4:array[-10..2000,-10..2200] of int64;
    ddnnew:array[-1..12,-1..12,0..200,0..3] of int64;
   newzan,marked,zanx,zany:array[-1000000..2000000] of boolean;
    ssold,sss1,sss2:string;
    def,stepen,koled,och,newoch,place,newnabor,stoim,nabor:array[-10..500005] of int64;
     zanleft,zanright,zan,fl:array[-100000..10000000] of boolean;
     dost:array[-1..210,-1..210,0..3,0..3] of int64;
    sss12:string;ch,ch1,ch2:char;
    pr,heshh,numright,dr: array [-10..206,-1..16] of int64;
    s3,s2,s1:array[-100..500000] of string;

    grr :array [-10..2010,-10..2010] of extended;
    maxpr:array[0..nnn] of string;
     tx,ty,vel,ott,v0,v1,s0,t0:int64;
     zv:point;
     left,right,ugol,rot,temp,sumtemp,vol,newx,newy:array[-1000..400000] of int64;
     mash,sqx,sqy,ottt:extended;
     xxxx,yyyy,yot:double;
       flag2,flag,flag1:boolean;

  function max(a,b:int64):int64;
begin max:=a; if b>a then max:=b;   end;

  function min(a,b:int64):int64;
begin min:=a; if b<a then min:=b;   end;

procedure udal(p:longint);
begin  next[prev[p]]:=next[p]; prev[next[p]]:=prev[p]; end;

      function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

     function summ(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p2+xx.p2*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=t1 div tt mod modul;
    t2:=t2 div tt mod modul;
    ott.p1:=t1; ott.p2:=t2;

   summ:=@ott;
 end;

     function prod(xx,yy:zap):zap1;
var t1,t2,tt:int64; ott:zap;
 begin
    t1:=(xx.p1*yy.p1) mod modul;
    t2:=(xx.p2*yy.p2) mod modul;
    tt:=nod(t1,t2);
    t1:=(t1 div tt) mod modul;
    t2:=(t2 div tt) mod modul;
    ott.p1:=t1; ott.p2:=t2;

   prod:=@ott;
 end;

    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p{/pi*180};
 end;

function degg(a,k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=degg(a,k-1)*a mod modul else
   begin  p:=degg(a,k shr 1); degg:=p*p mod modul;   end;

end;

function prost(tt:int64):boolean;
var aa:extended; i,p,t:longint;  fl:boolean;
 begin
   fl:=true;
   aa:=tt;
   aa:=sqrt(aa);
   t:=round(aa);
   for i:=2 to t do if tt mod i=0 then begin fl:=false; break; end;

   prost:=fl;
 end;

function arcsin(pp:extended):extended;
var tt:extended;
begin
   if (abs(pp)<=1+eps)and (abs(pp)>=1-eps)
   then if pp>0 then arcsin:=pi/2 else arcsin:=-pi/2;
   tt:=1-pp*pp;
   if abs(tt)>=0 then
     begin
        arcsin:=arctan(pp/sqrt(tt));

     end;

end;

function gl(ch:char):boolean;
begin
 if (ch='o')or (ch='a')or(ch='e')or(ch='u')or(ch='i') then gl:=true else gl:=false;

end;

function zaprmin(left,right:longint):int64;
begin
   if left>=right then zaprmin:=y[left] else
     begin
        if not odd(left) and odd(right) then zaprmin:=zaprmin(left shr 1,right shr 1) else
         begin
          if odd(left) then zaprmin:=min(zaprmin(left+1,right),y[left]);
          if not odd(right) then zaprmin:=min(zaprmin(left,right-1),y[right]);

         end;

     end;

end;

 function ff(gr:int64):boolean;

var ot,aa,bb,cc:int64; fl:boolean;
begin
  aa:=1; bb:=m;  cc:=aa; fl:=false;
  while abs(aa-bb)>1 do
    begin
       cc:=(aa+bb) shr 1;
       if y[cc]<gr then aa:=cc else bb:=cc;

    end;
   writeln(' cc= ',cc);
   cc:=min(cc+3,m+1);
   repeat dec(cc) until y[cc]<=gr;
   if y[cc]=gr then fl:=true else fl:=false;
  ff:=fl;
end;

function ogo(ll,rr:longint):boolean;
var i,j,k:longint; fl:boolean;

begin
  fl:=true;
  for i:=ll to rr do if (odd(i-ll) and (ss[i]<>'g'))or ((not odd(i-ll)) and (ss[i]<>'o')) then fl:=false;
  if ss[rr]<>'o' then fl:=false;
 ogo:=fl;
end;

function maxogo(ll,rr:longint):boolean;
var i,j:longint; fl:boolean;
begin
   fl:=ogo(ll,rr);
   if ogo(ll-2,rr) or ogo(ll,rr+2) then fl:=false;
   if rr-ll<2 then fl:=false;
   maxogo:=fl;
end;

begin
   { assign (input,'D:\Projects\input.txt');reset(input);
      assign (output,'D:\Projects\output.txt'); rewrite(output);
    }

      readln(n);
      readln(ss);
     { writeln(ss);
     } for i:=1 to n do for j:=i to n do if maxogo(i,j) then begin inc(q); x[q]:=i;y[q]:=j; end;

      { for i:=1 to q do writeln(x[i],' ',y[i]);
      } for i:=1 to q do for j:=x[i] to y[i] do zan[j]:=true;
       for i:=1 to n do if not zan[i] then write(ss[i]) else if zan[i] and not zan[i-1] then write('***');

     goto 1;

     readln(p,t);
     q:=1;
     x[1]:=p;
     ll:=q;
     rr:=q;
     for step:=1 to 30 do
       begin
          for i:=ll to rr do if 2*x[i]<2000000000 then begin inc(q); x[q]:=2*x[i]; y[q]:=i;  end;
          for i:=ll to rr do if 10*x[i]+1<2000000000 then begin inc(q); x[q]:=10*x[i]+1; y[q]:=i; end;
          ll:=rr+1; rr:=q;

       end;

      writeln('q= ',q);
      for i:=1 to q do write(x[i],' '); writeln;

      for i:=1 to q do if x[i]=t then begin flag:=true; ii:=y[i];  end;
      if not flag then writeln('NO');

      while (y[ii]<>1)and(tt<100) do begin inc(tt); z[tt]:=y[ii]; ii:=y[ii];   end;

     writeln('tt= ',tt);
    { for i:=1 to tt do write(x[])
     }

1:             close(output);
end.

program xssdsd;
var i,j,t,x:integer;a:string;
begin
readln(x);
readln(a);
a:=a+'ZZZZ';
t:=1;

while t<=x-2 do begin
if (a[t]='o')and(a[t+1]='g')and(a[t+2]='o') then begin
a[t]:='*';a[t+1]:='*';a[t+2]:='*';i:=t;end;
while i<=x-2 do begin
j:=i+3;i:=1;
while (a[j]='g') do begin
if (a[j]='g')and(a[j+1]='o')then delete(a,j,2);
j:=j+2;end;
i:=i+1;
if a[j]<>'g'then i:=x-1;
end;
t:=t+1;
end;
for i:=1 to x do
if (a[i]<>'Z')  then
write(a[i]);

end.

Program A;
CONST FINP = '1.INP';	FOUT = '1.OUT';
VAR fi, fo: text;

n: longint;
s:ansistring;

Procedure cut(k: longint);
Var i, j: longint;
BEGIN
i := pos('ogo', s);
if i = 0 then exit;
for j := 0 to 2 do s[i+j] := '*';
j := i+3;
while (j < n) and (copy(s, j, 2) = 'go') do
	begin
	s[j] := '*';	s[j+1] := '*';
	j := j + 2;
	end;
if j < n then cut(j);
END;

Procedure Process;
Var i: longint;
BEGIN

readln(fi, n);
readln(fi, s);

cut(1);

writeln(fo, s);

END;

BEGIN
{$IFDEF ONLINE_JUDGE}
assign(fi, '');		assign(fo, '');
{$ELSE}
assign(fi, FINP);	assign(fo, FOUT);
{$ENDIF}
reset(fi);			rewrite(fo);
Process;
close(fi);
close(fo);
END.

var
 s:ansistring;
 i,j,n,ch1,ch2,k,l,o:longint;
begin
 readln(n);
 readln(s);
 i:=1;
 while i<n do
 begin
 // writeln(i);
  if(s[i]='o')and(s[i+1]='g')and(s[i+2]='o')then
  begin
   //writeln(i);
   ch1:=i;
   i:=i+3;
  // writeln(ch1);
   if i+1<=n then
   while (s[i]='g')and(s[i+1]='o')do
   begin
    //writeln(n);
    inc(i,2);
    if i+1>n then break;
   end;
   for j:=ch1 to i-1 do s[j]:='*';
  end else
 inc(i);
 end;
 writeln(s);
end.

var n,i,j: integer;
s: string;
begin
readln(n); readln(s);
i:=1;
repeat if s[i]<>'o' then write(s[i])
        else begin
        j:=i+1;
        if j>n then break;
        while 'go'=copy(s,j,2) do j:=j+2;
        if j<>i+1 then begin
                write('***');
                i:=j-1;
                end;
        end;
        inc(i);
until i>n;
readln
end.

uses math;
var n,d,i,j,ans:longint;
    s,s1:string;
begin
readln(n);
read(s);
n:=length(s);
if s='ogo' then begin write('***'); halt; end;
if n<=3 then begin write(s); halt; end;
i:=1;
while i<=n-2 do
begin
s1:=s[i]+s[i+1]+s[i+2];
if s1='ogo' then write('***') else write(s[i]);
if s1='ogo' then begin
                 i:=i+3;
                 while i<n do
                 if s[i]+s[i+1]='go' then i:=min(n,i+2) else break;
                 end else inc(i);

end;
for j:=i to n do
write(s[j]);
end.

var n,d,i,j,ans:longint;
    s,s1:string;
begin
readln(n);
read(s);
n:=length(s);
if s='ogo' then begin write('***'); halt; end;
if n<=3 then begin write(s); halt; end;
i:=1;
while i<=n-2 do
begin
s1:=s[i]+s[i+1]+s[i+2];
if s1='ogo' then write('***') else write(s[i]);
if s1='ogo' then begin
                 i:=i+3;
                 while i<n do
                 if s[i]+s[i+1]='go' then i:=i+2 else break;
                 end else inc(i);

end;
for j:=i to n do
write(s[i]);
end.

Var a:string; i,j:longint;
    Begin
     readln(a);
     for i:=1 to length(a)-2 do
      begin
       if (a[i]='o') and (a[i+1]='g') and (a[i+2]='o')
        then
         begin
          a[i]:='*';
          a[i+1]:='*';
          a[i+2]:='*';
          j:=i+3;
          while (j+1<length(a)) and (a[j]='g') and (a[j+1]='o') do
           begin
            a[j]:='*';
            a[j+1]:='*';
            j:=j+2;
           end;
        end;
       end;
    writeln(a);
    End.

var
  a,b,i,n,k,j:longint;
  s,t:string;
begin
  readln(n);
  readln(s);
  t:=s;

  for i:=2 to n-1 do
  begin
    if (s[i-1]='o') and (s[i]='g') and (s[i+1]='o') and (t[i]<>'*') then
    begin
      t[i-1]:='*';
      t[i]:='*';
      t[i+1]:='*';
    end;
  end;

  writeln(t);
end.

var
   n,i:longint;
   s:string;
begin
   readln (n);
   readln (s);
   while pos('ogo',s)<>0 do
   begin
      i:=pos('ogo',s);
      delete(s,i,3);
      while pos('go',s)=i do
         delete (s,i,2);
      insert('***',s,i);
   end;
   writeln (s);
end.

var
   n,i,j:longint;
   s:string;
begin
   readln (n);
   readln (s);
   while pos('ogo',s)<>0 do
   begin
      i:=pos('ogo',s);
      delete(s,i,3);
      while pos('go',s)=i do
         delete (s,i,2);
      insert('***',s,i);
   end;
   writeln (s);
end.

var
   n,i,j:longint;
   s,a:string;
   f:boolean;
begin
   a:='';
   readln (n);
   readln (s);
   i:=1;
   f:=false;
   while i<n-1 do
   begin
      if (s[i]='o')and(s[i+1]='g')and(s[i+2]='o') then
      begin
         a:=a+'***';
         inc(i,3);
         f:=true;
      end
      else
         begin
            if f and(s[i]='g')and(s[i+1]='o') then inc(i,2)
            else
            begin
               a:=a+s[i];
               inc(i);
               f:=false;
            end
         end;
   end;
   while i<=n do
   begin
      a:=a+s[i];
      inc(i);
   end;
   writeln (a);
end.

var n,i:longint;
    s:string;
    ok:array[1..109] of boolean;
//------------------------------------------
begin
 readln(n);
 readln(s);
 fillchar(ok,sizeof(ok),true);
 for i:=1 to n-2 do
  begin
   if (s[i]='o') and (s[i+1]='g') and (s[i+2]='o') then
    begin
     ok[i]:=false;
     ok[i+1]:=false;
     ok[i+2]:=false;
    end;
  end;
 i:=1;
 while i<=n do
  begin
   if ok[i]=true then
    begin
     write(s[i]);
     inc(i);
    end
   else
   begin
    write('***');
    while (ok[i]=false) and (s[i]<>s[i-1]) do
    inc(i);
    if s[i]=s[i-1] then inc(i);
   end
  end;
end.

var st,ch:string;
i,n,p,p1,p2,p3,p4:longint;
begin
  readln(n);
  readln(st);
  ch:='***';
  p:=pos('ogo',st);
  if p=0 then
         begin
         writeln(st);
         halt;
         end;
  while p<>0 do
   begin
    p:=pos('ogo',st);
    p1:=pos('ogo',st);
     while p1<>0 do
      begin
       p1:=pos('ogo',st);
       delete(st,p1,3);
       insert(ch,st,p1);
       p4:=pos('*go',st);
       if p4<>0 then delete(st,p4+1,2);
      end;

    {p2:=pos('go',st);
     while p2<>0 do
      begin
       p2:=pos('go',st);
       delete(st,p2,2);
      end; }
    {p3:=pos('*g*',st);
     while p3<>0 do
      begin
       p3:=pos('*g*',st);
       delete(st,p3+1,p3-2);
      end;}

   end;
  delete(st,1,3);
  writeln(st);
end.

var st,ch:string;
i,n,p,p1,p2,p3:longint;
begin
  readln(n);
  readln(st);
  n:=length(st);
  ch:='***';
  p:=pos('ogo',st);
  while p<>0 do
   begin
    p:=pos('ogo',st);
    p1:=pos('ogo',st);
     while p1<>0 do
      begin
       if p1=0 then break;
       p1:=pos('ogo',st);
       delete(st,p1,3);
       insert(ch,st,p1);
      end;

    p2:=pos('go',st);
     while p2<>0 do
      begin
       p2:=pos('go',st);
       delete(st,p2,2);
      end;
    p3:=pos('*g*',st);
     while p3<>0 do
      begin
       p3:=pos('*g*',st);
       delete(st,p3+1,p3-2);
      end;

   end;
  delete(st,1,3);
  writeln(st);
end.

var st,ch:string;
i,n,p,p1,p2,p3:longint;
begin
  readln(n);
  readln(st);
  ch:='***';
  p:=pos('ogo',st);
  if p=0 then
         begin
         writeln(st);
         halt;
         end;
  while p<>0 do
   begin
    p:=pos('ogo',st);
    p1:=pos('ogo',st);
     while p1<>0 do
      begin
       if p1=0 then break;
       p1:=pos('ogo',st);
       delete(st,p1,3);
       insert(ch,st,p1);
      end;

    p2:=pos('go',st);
     while p2<>0 do
      begin
       p2:=pos('go',st);
       delete(st,p2,2);
      end;
    p3:=pos('*g*',st);
     while p3<>0 do
      begin
       p3:=pos('*g*',st);
       delete(st,p3+1,p3-2);
      end;

   end;
  delete(st,1,3);
  writeln(st);
end.

var st,ch:string;
i,n,p,p1,p2,p3,p4:longint;
begin
  readln(n);
  readln(st);
  ch:='***';
  p:=pos('ogo',st);
  if p=0 then
         begin
         writeln(st);
         halt;
         end;
  while p<>0 do
   begin
    p:=pos('ogo',st);
    p1:=pos('ogo',st);
     while p1<>0 do
      begin
       p1:=pos('ogo',st);
       delete(st,p1,3);
       insert(ch,st,p1);
       p4:=pos('*go',st);
       if p4<>0 then delete(st,p4+1,2);
      end;

    {p2:=pos('go',st);
     while p2<>0 do
      begin
       p2:=pos('go',st);
       delete(st,p2,2);
      end; }
    p3:=pos('*g*',st);
     while p3<>0 do
      begin
       p3:=pos('*g*',st);
       delete(st,p3+1,p3-2);
      end;

   end;
  delete(st,1,3);
  writeln(st);
end.

var n,i,j,k,l:longint;

s,s1,s2:ansistring;
begin
readln(n);
readln(s);
s1:='ogo';
while pos(s1,s)>0 do begin
    i:=pos(s1,s);
    l:=3;
    s2:=s1;
    while ((pos(s2,s)>0)and(l<n)and(pos(s2,s)=i)) do begin
        s2:=s1+'go';
     //   writeln(s2);
        l:=l+2;
    end;
    l:=l-2;
    delete(s,i,l);
    insert('***',s,i);
 //   writeln(s);
end;
writeln(s);
end.

var n,i,j,k,l:longint;

s,s1,s2:ansistring;
begin
readln(n);
readln(s);
s1:='ogo';
while pos(s1,s)>0 do begin
    i:=pos(s1,s);
    l:=3;
    s2:=s1;
    while ((pos(s2,s)>0)and(i+l<=n+1)and(pos(s2,s)=i)) do begin
        s2:=s1+'go';
     //   writeln(s2);
        l:=l+2;
    end;
    l:=l-2;
    delete(s,i,l);
    insert('***',s,i);
 //   writeln(s);
end;
writeln(s);
end.

var n,i,j,k,l:longint;

s,s1,s2:ansistring;
begin
readln(n);
readln(s);
s1:='ogo';
while pos(s1,s)>0 do begin
    i:=pos(s1,s);
    l:=3;
    s2:=s1;
    while ((pos(s2,s)>0)and(i+l<=n)and(pos(s2,s)=i)) do begin
        s2:=s1+'go';
     //   writeln(s2);
        l:=l+2;
    end;
    l:=l-2;
    delete(s,i,l);
    insert('***',s,i);
 //   writeln(s);
end;
writeln(s);
end.