Advertisement
DMG

Cenzura (S)

DMG
Apr 4th, 2013
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include<iostream>
  2. #include <string>
  3. using namespace std;
  4. main()
  5. {
  6.       int n, m=0, k;
  7.       string cenzura[100], s;
  8.  
  9.       cin >> n;
  10.      
  11.       for (int i=0; i<n; i++)
  12.           cin >> cenzura[i];
  13.      
  14.       // praznjenje buffera
  15.       fseek(stdin,0,SEEK_END);
  16.      
  17.       getline(cin, s);
  18.      
  19.       for (int i=0; i<n; i++)
  20.       for (int j=0; j<s.length(); j++)
  21.           if (s.substr(j, cenzura[i].length())==cenzura[i])
  22.           {
  23.               for (k=j; k<j + cenzura[i].length(); k++)
  24.                   s[k] = '*';            
  25.               j = j + cenzura[i].length();
  26.           }
  27.      
  28.       cout << s << endl;
  29.      
  30.      
  31.       system("PAUSE");
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement