Akash your code is good but it can be code more short
#include <stdio.h>
int main()
{
unsigned long long int a = 0;
char str[]="harish chandra pran";
int i, j;
for ( i = j = 0; str[i]; i++ )
{
int offset=0;
if ( str[i] >= 'a' && str[i] <= 'z' ) offset=26;
offset+= str[i] - 'A';
if ( (a & (1 << offset)) == 0 )
{
a |= (1<< offset);
str[j++] = str[i];
}
}
str[j] = '\0';
printf ("%s\n", str );
return 0;
}
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.