Source code for submission s1408

Go to diff to previous submission

bugs.cpp

  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <iostream>
  4. #include <cstring>
  5.  
  6.  
  7. using namespace std;
  8.  
  9.  
  10. int main()
  11. {
  12. int n, len;
  13. string s;
  14. char line[2000000];
  15. char * o, * tmp;
  16. while (cin >> n >> s)
  17. {
  18. //getchar();
  19. for (int i=1; i<=n; i++)
  20. {
  21. len=0;
  22. do {
  23. line[len++] = getchar();
  24. } while (line[len-1] !='\n');
  25. line[len-1] = 0;
  26. tmp = line;
  27.  
  28. while ((o = strstr(tmp, s.c_str()))) {
  29.  
  30. while (tmp < o)
  31. {
  32. printf("%c", tmp[0]);
  33. tmp++;
  34. }
  35. tmp += s.length();
  36. };
  37. while (tmp < line+len)
  38. {
  39. printf("%c", tmp[0]);
  40. tmp++;
  41. }
  42. printf("\n");
  43. }
  44. }
  45.  
  46. return 0;
  47. }
  48.  

Diff to submission s1372

bugs.cpp

--- c4.s1372.cteam045.bugs.cpp.0.bugs.cpp
+++ c4.s1408.cteam045.bugs.cpp.0.bugs.cpp
@@ -16,5 +16,5 @@
         while (cin >> n >> s)
         {
-                getchar();
+                //getchar();
                 for (int i=1; i<=n; i++)
                 {