// 15. Count the frequency of a given letter in a string
#include <stdio.h>

int main() {
    char str[100], letter;
    int count = 0;

    printf("Enter a string: ");
    fgets(str, sizeof(str), stdin);   // reads the whole line, including spaces

    printf("Enter the letter to count: ");
    scanf("%c", &letter);

    for (int i = 0; str[i] != '\0'; i++) {
        if (str[i] == letter) {
            count++;
        }
    }

    printf("Frequency of '%c' = %d\n", letter, count);

    return 0;
}
