int i = 0, j = 0; while( av[1][i] != '\0' && av[2][j] != '\0'){ int k = 0; int counter = 0; while(k < i){ if(av[1][k] == av[1][i]) counter++; k++; } if(counter != 0){ i++; continue; } while( av[2][j] != '\0'){ if( av[1][i] == av[2][j] ){ counter++; break; } j++; } if(counter == 1) printf("%c", av[1][i]); i++; j = 0; }