#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

char *strreplace(char *str,const char *from,const char *to)
    
    {
    
    	char *p=str;
    
    	while( p=strstr(p,from) )
    
    	{
    
    		memmove(p+strlen(to),p+strlen(from),strlen(p+strlen(from))+1);
    
    		memcpy(p,to,strlen(to));
    
    		p+=strlen(to);
    
    	}
    
    	return str;
    
    }
    
    
    
    
    
    int main()
    
    {                                              // 3. Variante

    char string3[200] = "Hallo, diese Nachricht wird ersetzt. Dieser Quelltext gehoert zu den Systemen.";

    printf("Vorher: %s\n", string3);                                            // Vorher

    printf("Nachher: ");                                                        // Nachher
    printf(strreplace(string3,"en","x"),strreplace(string3,"x","en"), strreplace(string3,"er","q"), strreplace(string3,"q","er"), strreplace(string3,"y","ch"),strreplace(string3,"ch","y"), strreplace(string3,"a","o"), strreplace(string3,"o","a"));


    return 0;
}
