hdu1020

来源:互联网 发布:js中window对象 编辑:程序博客网 时间:2024/05/16 12:13
#include <iostream>#include <string>#include <cstring>using namespace std;int T;string str;int _count[26];char cc;int main(){    cin>>T;    while(T--)    {        cin>>str;        memset(_count,0,sizeof(_count));        for(int i = 0;i < str.length(); i ++)        {                _count[str[i]-'A']++;        }        for(int i = 0; i < 26; i++)        {                cc= 'A'+i;                if(_count[i]!=0)                {                      if(_count[i] == 1)                             cout<<cc;                      else                             cout<<_count[i]<<cc;                }        }        if(T!=1)        cout<<endl;    }    return 0;}

原创粉丝点击