#include <bits/stdc++.h>
using namespace std;
bool used[300000];
vector<int> g;
vector<pair<int, int>> graph;
int scene[1000][1000];
int pred[1000][1000];
vector<int> c;
int find_set(int v) {
  if (g[v] == v) return v;
  return g[v] = find_set(g[v]);
}
int main() {
  int n;
  cin >> n;
  char c;
  bool flag = false;
  string s = "";
  for (int i = 0; i < n; i++) {
    cin >> c;
    if (!flag) {
      if (c == 'o') {
        s = 'o';
        flag = true;
      } else {
        cout << c;
      }
    } else {
      if ((s[s.length() - 1] == 'o') & (c == 'g')) {
        s += 'g';
      } else if ((s[s.length() - 1] == 'g') & (c == 'o')) {
        s += 'o';
      } else if (s.length() >= 3) {
        if (s[s.length() - 1] == 'g') {
          cout << "***g" << c;
          flag = false;
          s = "";
        } else if (c == 'o') {
          cout << "***";
          s = "o";
        } else {
          cout << "***" << c;
          flag = false;
          s = "";
        }
      } else {
        if (c == 'o') {
          cout << s;
          s = "o";
        } else {
          cout << s << c;
          flag = false;
          s = "";
        }
      }
    }
  }
  if (flag) {
    if (s.length() >= 3) {
      if (s[s.length() - 1] == 'g')
        cout << "***g";
      else
        cout << "***";
      s = "";
      flag = false;
    } else {
      cout << s;
      s = "";
      flag = false;
    }
  }
  return 0;
}
