Advertisement
shinema

Untitled

Oct 12th, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include<string>
  3. #include<fstream>
  4. #include<algorithm>
  5. using namespace std;
  6. int main(){
  7. int risultato=0;
  8. ifstream in;
  9. ofstream ou;
  10. in.open("input.txt");
  11. string a;
  12. getline(in,a);
  13. for(int i=0;i<a.length();i++){
  14. if(a[i]=='h'&&a[i+1]=='e'&&a[i+2]=='l'&&a[i+3]=='l'&&a[i+4]=='o'){
  15. for(int k=i+5;k<a.length();k++){
  16. if(a[k]=='w'&&a[k+1]=='o'&&a[k+2]=='r'&&a[k+3]=='l'&&a[k+4]=='d')
  17. risultato++;
  18. }
  19. }
  20. }
  21. ou.open("output.txt");
  22. ou<<risultato;
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement