String replacement in C