Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<fstream>
- #include<string.h>
- #include<stdio.h>
- #include<stdlib.h>
- using namespace std;
- int main(){
- ifstream f1("atestat.in");
- ofstream f2("atestat.out");
- char n[100];
- int i,l=0;
- f1.getline(n,100);
- for(i=1;i<strlen(n);i++){
- if(n[i-1] != n[i] && l >= 2){
- f2<<endl;
- l=0;
- }
- if(n[i-1] == n[i] && ( n[i-1] >= 'a' && n[i-1] <= 'z' && n[i] >= 'a' && n[i] <= 'z' )){
- l++;
- if(l <= 2)
- f2<<n[i-1];
- strcpy(n+i-1,n+i);
- i--;
- }
- }
- f2<<n;
- f1.close();
- f2.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement