C - 5857
Thanks to @ceilingcat, @hvd and @AShelly for saving a bunch of characters. There were multiple ways suggested of making it much shorter than the original:
// @hvd@ceilingcat - alwaysuse copyindex() toinstead qof butstrchr() j(char*s){char*q=s,*p=s;for(;*q=*p;q+=q==index(s,*p++));} // only@hvd increment q if not found - modify in place gi(char*s,char*r){char*q=r;forchar*q=s,*p=s;for(;*q=*s;q+=q==strchr;*q=*p;q+=q==strchr(rs,*s++*p++));} // @AShelly - keep a histogram of the usage of each character h(char*s){int a[128]={0};for(;*s;s++)a[*s]++||putchar(*s);} // @hvd - modifyalways incopy placeto q but only increment q if not found ig(char*s,char*r){char*q=s,*p=s;forchar*q=r;for(;*q=*p;q+=q==strchr;*q=*s;q+=q==strchr(sr,*p++*s++));} // original version - requires -std=c99 void f(char*s,char*r){for(char*q=r;*s;s++)if(!strchr(r,*s))*q++=*s;}