bugs.cpp
#include<iostream>
#include<cstdio>
using namespace std;
int main ( void )
{
int number;
string error;
string line;
char character;
while ( cin >> number >> error )
{
scanf ( "%c", &character);
for ( int i = 0; i < number; i++ )
{
int counter = 0;
line . clear ();
while ( 1 )
{
scanf ( "%c", &character);
if ( character == '\n' )
{
break;
}
line . push_back ( character );
counter++;
}
if ( !counter )
{
cout << endl;
continue;
}
while ( 1 )
{
string::size_type n;
n = line . rfind ( error.c_str() );
if ( n == string::npos )
break;
line . erase ( n, error . length () );
}
cout << line << endl;
}
}
}