Can you please me regarding the correction needed in code because my 25 cases are not pasing .So can you u pls tell me where is the correction needed

#include
using namespace std;

void st_compress(char a[], int n) {
int freq[26] = {0};

for(int i = 0; a[i] != '\0'; i++) {
    char ch = a[i];
    if (isalpha(ch)) {
        int index = tolower(ch) - 'a';
        freq[index]++;
    }
}

for(int i = 0; i < 26; i++) {
    if(freq[i] > 1) {
        char x = i + 'a';
        cout << x << freq[i];
    } else if(freq[i] == 1) {
        char x = i + 'a';
        cout << x;
    }
}

}

int main() {
char a[1000];
cin.getline(a, 1000);

int n = 0;
while(a[n] != '\0') {
    n++;
}

st_compress(a, n);

return 0;

}