View Code of Problem 36

#include <iostream>
#include <string.h>
using namespace std;

int main(){
  int n,c[26];
  char str[1001];
  scanf("%d",&n);
  while(n--){
    scanf("%s",str);
    int len = strlen(str);
    for(int j=0;j<len;j++){
      c[str[j]-'A']++;
    }
    for(int k=0;k<26;k++){
      if(c[k]!=0){
        printf("%d%c",c[k],'A'+k);
      }
    }
    printf("\n");
  }
  return 0;
}

Double click to view unformatted code.


Back to problem 36