Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdbool.h>
- int main(int argc, char* argv[]) {
- char* A = argv[1];
- char* B = argv[2];
- char* C = argv[3];
- size_t A_len = strlen(A);
- size_t B_len = strlen(B);
- size_t C_len = strlen(C);
- for (size_t i = 0; i < A_len; i++){
- bool reemplazo = true;
- for (size_t j = 0; j < B_len; j++) {
- if (A[i + j] != B[j]) {
- reemplazo = false;
- break;
- }
- }
- if (reemplazo) {
- printf("%s", C);
- i += B_len - 1;
- } else {
- printf("%c", A[i]);
- }
- }
- printf("\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement