fork download
  1. #include<iostream>
  2. #include<string.h>
  3. using namespace std;
  4.  
  5. void deDupe(char *a) {
  6. int i=0, j=0;
  7. int b[256]={0};
  8. memset(b, 0, sizeof(b));
  9. while(a[i]!='\0') {
  10. if(b[a[i]]==0) {
  11. b[a[i]]=1;
  12. a[j++]=a[i++];
  13. } else {
  14. i++;
  15. }
  16. }
  17. a[j]='\0';
  18. return ;
  19. }
  20.  
  21. int main() {
  22. char a[100];
  23. scanf("%s",a);
  24. deDupe(a);
  25. cout<<a<<endl;
  26. return 0;
  27. }
Success #stdin #stdout 0.01s 2728KB
stdin
kappp*+*&*&ilp
stdout
kap*+&il