I observed this:

while(*s != '\0')
*s++;
It is unnecessary to dereference s if your intention is only to increment it, i.e.,

while (*s != '\0')
s++;