fork download
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <string>
  5. #include <iterator>
  6. using namespace std;
  7.  
  8. int main() {
  9. string rpl("xx-xxx-xx-xxxx");
  10. vector<string> cnt;
  11.  
  12. string tmp;
  13. while(getline(cin, tmp)) {
  14. cnt.push_back(tmp);
  15. }
  16.  
  17. size_t ind;
  18. for(string& el : cnt) {
  19. if((ind = el.find("PL")) == string::npos) {
  20. continue;
  21. }
  22. el.replace(ind, rpl.size(), rpl);
  23. el.erase(ind + rpl.size(), 1);
  24. }
  25.  
  26. copy(
  27. cnt.begin(),
  28. cnt.end(),
  29. ostream_iterator<string>(cout, "\n")
  30. );
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0s 2992KB
stdin
      277  47-25- 7 S PL-0198-12-3194 1  1-10:08:49  1524.26   0.20 100.00 20.00 40.00   35.00  379260
      277  60- 7- 7 S PL-0277-10-1229 1  1-10:03:00  1518.15   0.41  99.90 20.00 39.99   34.99  368910
      277  64-15- 7 S PL-0277-10-2722 0  1- 9:57:42  1515.44   0.61  99.80               34.99  360220
      277  78-21- 7 - PL-0277-07-4469 0  1-10:06:20  1496.59   0.82  99.69 19.99 39.98   34.98  368660
      227  54- 5- 5 S PL0227-12-10843 0  1- 9:58:54  1492.26   1.02  99.59               34.97  356500
      277  49-13- 7 S PL-0277-08-5048 0  1-10:05:10  1492.05   1.23  99.49 19.98 39.96   34.96  365800
      227  94-34- 7 - PL0227-10-10175 0  1-10:02:14  1489.18   1.43  99.39 19.98 39.95   34.96  360730
      277  37- 9- 7 S PL-0224-09-7794 0  1-10:14:21  1489.13   1.64  99.28 19.97 39.94   34.95  378760
      277  57-28- 7 S PL-0277-09-1631 1  1-10:05:41  1489.03   1.84  99.18 19.97 39.93   34.94  365830
stdout
      277  47-25- 7 S xx-xxx-xx-xxxx 1  1-10:08:49  1524.26   0.20 100.00 20.00 40.00   35.00  379260
      277  60- 7- 7 S xx-xxx-xx-xxxx 1  1-10:03:00  1518.15   0.41  99.90 20.00 39.99   34.99  368910
      277  64-15- 7 S xx-xxx-xx-xxxx 0  1- 9:57:42  1515.44   0.61  99.80               34.99  360220
      277  78-21- 7 - xx-xxx-xx-xxxx 0  1-10:06:20  1496.59   0.82  99.69 19.99 39.98   34.98  368660
      227  54- 5- 5 S xx-xxx-xx-xxxx 0  1- 9:58:54  1492.26   1.02  99.59               34.97  356500
      277  49-13- 7 S xx-xxx-xx-xxxx 0  1-10:05:10  1492.05   1.23  99.49 19.98 39.96   34.96  365800
      227  94-34- 7 - xx-xxx-xx-xxxx 0  1-10:02:14  1489.18   1.43  99.39 19.98 39.95   34.96  360730
      277  37- 9- 7 S xx-xxx-xx-xxxx 0  1-10:14:21  1489.13   1.64  99.28 19.97 39.94   34.95  378760
      277  57-28- 7 S xx-xxx-xx-xxxx 1  1-10:05:41  1489.03   1.84  99.18 19.97 39.93   34.94  365830