Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <string.h>
- #include <cstring>
- using namespace std;
- char a[100];
- int n;
- int main(int argc,char *argv[]) {
- cin >> n;
- for(int i = 1; i <= n; i++){
- cin >> a[i];
- }
- for(int i = 1; i <= n; i++){
- if(a[i] == 'o' && a[i+1] == 'g' && a[i+2] == 'o' && a[i+3] == 'g' && a[i+4] == 'o' && a[i+5] == 'g' && a[i+6] == 'o'){
- cout << "***";
- i = i + 6;
- }
- else if(a[i] == 'o' && a[i+1] == 'g' && a[i+2] == 'o' && a[i+3] == 'g' && a[i+4] == 'o'){
- cout << "***";
- i = i + 4;
- }
- else if(a[i] == 'o' && a[i+1] == 'g' && a[i+2] == 'o'){
- cout << "***";
- i = i + 2;
- }
- else{
- cout << a[i];
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement