Advertisement
Falak_Ahmed_Shakib

string count aa bb zz

Jul 5th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5. char temp,str[101];
  6.  
  7. int i,j,n,count=1;
  8.  
  9. gets(str);
  10. n=strlen(str);
  11.  
  12. for(i=0; i<n-1; i++)
  13. {
  14. for(j=0; j<n-i; j++)
  15. {
  16. if(str[j]<str[j+1])
  17. {
  18. temp=str[j];
  19. str[j]=str[j+1];
  20. str[j+1]=temp;
  21. }
  22. } printf("%c%c",str[i],str[j]);
  23. }
  24.  
  25.  
  26.  
  27.  
  28. for(i=0; i<n-1; i++)
  29. {
  30. if(str[i]!=str[i+1])
  31. count++;
  32. }
  33. if(count%2==0)
  34. printf("CHAT WITH HER!");
  35. else
  36. printf("IGNORE HIM!");
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement