Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- main () {
- string input;
- string currentWord="";
- string output="";
- int counter=0;
- int counterN=0.0,counterO=0.0,counterC=0.0;
- while(input!="End"){
- cin>>input;
- if(input=="End"){
- cout<<output<<endl;
- break;
- }
- char cinput=input.at(0);
- if ((cinput>='a' && cinput<='z') || (cinput>='A' && cinput<='Z')){
- if(cinput=='n' && counterN<1){
- counterN++;
- counter++;
- } else if (cinput=='o' && counterO<1){
- counterO++;
- counter++;
- } else if (cinput=='c' && counterC<1){
- counterC++;
- counter++;
- } else {
- currentWord+=input;
- }
- }
- if(counter==3){
- output=output+currentWord;
- currentWord=" ";
- output=output+currentWord;
- currentWord="";
- counterN=0;
- counterO=0;
- counterC=0;
- counter=0;
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment