Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdbool.h>
- void imprimir(const char* A, const char* B) {
- size_t len_A = strlen(A);
- size_t len_B = strlen(B);
- for (size_t i = 0; i < len_A; ++i) {
- if (i + len_B > len_A) {
- printf("%c", A[i]);
- continue;
- }
- bool coincide = true;
- for (size_t j = 0; j < len_B; ++j) {
- if (A[i + j] != B[j]) {
- coincide = false;
- break;
- }
- }
- if (!coincide) {
- printf("%c", A[i]);
- } else {
- i += len_B - 1;
- }
- }
- }
- int main() {
- imprimir("Make America great again", "great ");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement