mostlabs

13/3-1

Apr 28th, 2020
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4.  
  5.  
  6. using namespace std;
  7.  
  8.  
  9.  
  10. int main()
  11. {
  12.     cout << "Enter text: " << endl;
  13.     string text;
  14.     getline(cin, text);
  15.    
  16.    
  17.    
  18.     int a = text.size();
  19.    
  20.    
  21.     for (int i = 0; i <a ; i++) {
  22.        
  23.         if (text[i] == 'k' || text[i] == 'l') {
  24.            
  25.             for (int j = i;  j < a; j++)
  26.             {
  27.                
  28.                 if (text[j + 1] == 'k' || text[j + 1] == 'l' || text[j + 1] == 'm') {
  29.                     cout << endl;
  30.                         break;
  31.                 }
  32.                  
  33.  
  34.                 text[j-i] = text[i+1];
  35.                
  36.                 cout << text[j+1];
  37.                
  38.             }
  39.  
  40.  
  41.         }
  42.        
  43.     }
  44. }
Add Comment
Please, Sign In to add comment