Go to diff to previous submission
#include <cstdio> #include <cstdlib> #include <iostream> #include <cstring> using namespace std; int main() { int n, len; string s; char line[2000000]; char * o, * tmp; while (cin >> n >> s) { //getchar(); for (int i=1; i<=n; i++) { len=0; do { line[len++] = getchar(); } while (line[len-1] !='\n'); line[len-1] = 0; tmp = line; while ((o = strstr(tmp, s.c_str()))) { while (tmp < o) { printf("%c", tmp[0]); tmp++; } tmp += s.length(); }; while (tmp < line+len) { printf("%c", tmp[0]); tmp++; } printf("\n"); } } return 0; }