blob: 00501cad198158ac7bbe636294f479deccdb98d0 (
plain) (
tree)
|
|
#include <stdio.h>
void squeeze_char(char s[], char c) {
int i;
int j;
for (i = j = 0; s[i]; i++)
if (s[i] != c)
s[j++] = s[i];
s[j] = '\0';
}
void squeeze_str(char s1[], char s2[]) {
int i;
for (i = 0; s2[i]; ++i)
squeeze_char(s1, s2[i]);
}
void squeeze_all(char s1[], char s2[]) {
int i;
int j;
int k;
for (k = 0; s2[k]; ++k) {
for (i = j = 0; s1[i]; ++i)
if (s1[i] != s2[k])
s1[j++] = s1[i];
s1[j] = '\0';
}
}
int main() {
char squeezed[] = "abracadabra";
squeeze_all(squeezed,"abc");
printf("%s\n", squeezed);
}
|