Q.) FIND UNIQUE CHAR IN A GIVEN STRING.
SOLUTION---
SOLUTION---
#include#include int main() { char str[400]; scanf("%s",str); int i,d,len; len=strlen(str); int arr[128]; for(i=0;i<128;i++) arr[i]=0; for(i=0;i<len;i++) { d=str[i]; arr[d]+=1; } for(i=0;i<len;i++) { d=str[i]; if(arr[d]==1){ printf("%c ->unique char in string",str[i]); } } return 0; }
3 comments:
remove break statement else if there are more than one unique characters in string, program will not print them.it will only print the first unique char
thnxx @rajpal sir :)
can you plz implement and explain longest increasing subsequence...
Post a Comment