#include < stdio.h >
#include < stdlib.h >
#include < string.h >
int main() {
char * str = "Hi I am Good and Printing Duplicate";
// for ASCII characters only
static int strCount[256];
// count the total occurences
for (int i = 0; i < strlen(str); i++) {
++strCount[ * (str + i)];
}
// count is stored at the place of respective ASCII value Index
for (int i = 0; i < 256; i++) {
if (strCount[i] > 1) {
printf("'%c',", i);
}
}
return 0;
}
Print Duplicate Characters in String
