fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int main() {
  6. char a[2005], b[1005];
  7. cin.getline(a, 1005, '.');
  8. cin.getline(b, 1005);
  9.  
  10. int n = strlen(a);
  11. int m = strlen(b);
  12. int pos = -1;
  13.  
  14. for(int i = 0; i <= n - 4; i++) {
  15. if(a[i] == 'c' && a[i+1] == 'o' && a[i+2] == 'd' && a[i+3] == 'e') {
  16. pos = i + 4;
  17. break;
  18. }
  19. }
  20.  
  21. if(pos == -1) {
  22. cout << a;
  23. } else {
  24. for(int i = 0; i < pos; i++) cout << a[i];
  25. cout << b;
  26. for(int i = pos; i < n; i++) cout << a[i];
  27. }
  28.  
  29. return 0;
  30. }
  31.  
  32.  
Success #stdin #stdout 0.01s 5284KB
stdin
codedreamcodedream true
stdout
codedreamcodedream true