close
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <iostream>
#include <stdlib.h>
struct T
{
char ch;
int Fre=0;
};
bool operator < (const T &lhs,const T &rhs)
{
return lhs.Fre > rhs.Fre;
}
int main()
{
T record[26];
int count=0;
int n;
std::string str;
scanf("%d",&n);
// getchar();
// getchar();
getline(std::cin,str);
while(n--)
{
//printf("PIG!\n");
getline(std::cin,str);
for(int i=0;i<str.length();i++)
{
if(isalpha(str[i]))
{
if(! record[toupper(str[i])-'A'].Fre)
{
record[toupper(str[i])-'A'].ch = toupper(str[i]);
}
record[toupper(str[i])-'A'].Fre++;
}
}
}
std::stable_sort(record,record+26);
for(int i=0;i<26;i++)
{
if(record[i].Fre)
printf("%c %d\n",record[i].ch,record[i].Fre);
}
return 0;
}
#英文字元處理#sort
文章標籤
全站熱搜