Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cstring>
  4.  
  5. using namespace std;
  6.  
  7. int main(){
  8. ifstream fin;
  9. ofstream fout;
  10. fin.open("in.txt", ios::in);
  11. fout.open("out.txt", ios::out);
  12. char n, a[10000],str[100000];
  13. int c = 0, i = 0;
  14. fin.getline(str,10000);
  15. for (int j=0;j<strlen(str);j++){
  16. n=str[j];
  17. if (n == 'e'&&c == 0){
  18. c = 1;
  19. a[i++] = n;
  20. }
  21. else{
  22. if (n == 'n'&&c == 1){
  23. c = 2;
  24. a[i++] = n;
  25. }
  26. else{
  27. if (n == 'd'&&c == 2){
  28. a[i++] = n;
  29. break;
  30. }
  31. else{
  32. c = 0;
  33. a[i++] = n;
  34. }
  35. }
  36. }
  37. }
  38. fout << i << endl;
  39. for (int j = 0; j < i; j++){
  40. fout << a[j] << ' ';
  41. }
  42. fin.close();
  43. fout.close();
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement