~cpp
#include <iostream>
#include <fstream>
using namespace std;
char buffer[100]={0};
int max,count;
int start_Number, end_Number;
bool ing_Number=false;
bool test(int index)
{
if ( index <max && 48<= (int)buffer[index] && (int)buffer[index] <= 57 ){
if(ing_Number)
end_Number= index;
if(!ing_Number)
{
ing_Number=true;
start_Number = index;
end_Number= index;
}
test(index+1);
}
else if(ing_Number)
{
ing_Number=false;
return true;
}
else return false;
}
void extract()
{
ifstream fin("input_e.txt");
int i=0,j, number;
while(fin.get(buffer[i]))
{
i++;
}
max = i;
for(i=0;i<max ; i++)
{
number=0;
if(test(i))
{
for(j=start_Number ;j<= end_Number;j++)
number = number*10 +(int)(buffer[j])-48;
for(int k=0;k<number;k++)
cout << buffer[end_Number+1];
}
}
cout << endl;
}
void compression()
{
char buffer[100];
int i=0;
ifstream fin("input_e.txt");
while(fin.get(buffer[i]))
{
i++;
while(buffer[i]==buffer[i+1])
count++;
}
cout << buffer[i] << count;
}
int main()
{
compression();
extract();
return 0;
}