Guest User

Untitled

a guest
Nov 6th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. char a[80], com[80],buff[80];
  6. printf("enter the string\n");
  7. scanf("%[^\n]s", a);
  8. com[0] = 'o';
  9. com[1] ='\0';
  10. int i,j,n;
  11. char last = a[0];
  12. for (i = 1;a[i] != '\0';i++)
  13. {
  14. if(last == a[i])
  15. {
  16. buff[0] = a[i];
  17. buff[1] = a[i];
  18. for(j=2;a[i-1+j]!='\0';j++)
  19. {
  20. buff[j] = a[i-1+j];
  21. }
  22. buff[j] = '\0';
  23. for(j=i+1;buff[j-i-1]!='\0';j++)
  24. {
  25. a[j]=buff[j-i-1];
  26.  
  27. }
  28. a[j] = '\0';
  29. i+=2;
  30. }
  31. last = a[i];
  32. }
  33. for (n = 0;a[n]!='\0';n++)
  34. {
  35. printf("%c", a[n]);
  36. }
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment