Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstring>
- using namespace std;
- int main(){
- ifstream fin;
- ofstream fout;
- fin.open("in.txt", ios::in);
- fout.open("out.txt", ios::out);
- char n, a[10000],str[100000];
- int c = 0, i = 0;
- fin.getline(str,10000);
- for (int j=0;j<strlen(str);j++){
- n=str[j];
- if (n == 'e'&&c == 0){
- c = 1;
- a[i++] = n;
- }
- else{
- if (n == 'n'&&c == 1){
- c = 2;
- a[i++] = n;
- }
- else{
- if (n == 'd'&&c == 2){
- a[i++] = n;
- break;
- }
- else{
- c = 0;
- a[i++] = n;
- }
- }
- }
- }
- fout << i << endl;
- for (int j = 0; j < i; j++){
- fout << a[j] << ' ';
- }
- fin.close();
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement