Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define LEN 15
- int main(void)
- {
- char string[LEN+1], ch;
- printf("Enter a word>\n");
- scanf("%s", string);
- for (ch = 'a'; ch <= 'z'; ch++)
- {
- int count = 0, i;
- for (i = 0; i < strlen(string); i++)
- {
- if (ch == string[i])
- {
- count++;
- }
- }
- if (count > 1)
- {
- printf("Duplicate letter: %c, Occurrences: %d\n", ch, count);
- }
- else
- {
- printf("No duplicates found\n");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement