I\'m learning how to write programs in C using the k&r book (The C Programming Language) and I have a problem with one of the exercises. It\'s asking me to detect and re
Great book. If I were you, I would proceed exactly as for the squeeze() in section 2.8, but instead of a direct comparison (s[i] != c) I would write and exploit a function
int contains(char s[], int c)
which returns 1 if the string s contains c, 0 otherwise. Start with the simple approach; when it works you may improve performance with more complex solutions (binary search, but note that the problem doesn't require the characters in s2 to be in a particular order).