Advertisement
askarulytarlan

Untitled

Nov 23rd, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <string.h>
  4. #include <cstring>
  5.  
  6. using namespace std;
  7.  
  8. char a[100];
  9. int n;
  10.  
  11. int main(int argc,char *argv[]) {
  12. cin >> n;
  13. for(int i = 1; i <= n; i++){
  14. cin >> a[i];
  15. }
  16. for(int i = 1; i <= n; i++){
  17. 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'){
  18. cout << "***";
  19. i = i + 6;
  20. }
  21. else if(a[i] == 'o' && a[i+1] == 'g' && a[i+2] == 'o' && a[i+3] == 'g' && a[i+4] == 'o'){
  22. cout << "***";
  23. i = i + 4;
  24. }
  25. else if(a[i] == 'o' && a[i+1] == 'g' && a[i+2] == 'o'){
  26. cout << "***";
  27. i = i + 2;
  28. }
  29. else{
  30. cout << a[i];
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement