#include <iostream>
#include <string.h>
using namespace std;
#define MAX 300
void DemKyTu(char s[]);
int myStrcmp(char s1[MAX], char s2[MAX]);
int myStrlen(char s[], int k);
int main()
{
char s[MAX];
//gets(s); //Nhap chuoi s
cin.getline(s,MAX);
if (myStrcmp(s, "") == 0)
cout << "Chuoi rong." << endl;
else
DemKyTu(s);
return 0;
}
int myStrlen(char s[], int k){
int dem = 0;
for (int i=0;s[i]!='\0';i++) ++dem;
//cout << dem << endl;
return dem;
}
int myStrcmp(char s1[MAX], char s2[MAX]){
bool check_space = false;
if (myStrlen(s1,0)==0) return 0;
for (int i=0;i<myStrlen(s1,0);i++) if (s1[i]!=' ') check_space=true;
if (check_space==false) return -1; // chuoi toan dau cach
return 1;
}
void DemKyTu(char s[]){
int m=0;
int dem[300];
bool check[300];
char c[300];
for (int i=1;i<300;i++){
check[i]=false;
dem[i]=0;
}
for (int i=0; s[i]!='\0';i++){
if (check[s[i]]==true){
//cout << i << " " << s[i] << " " << dem[s[i]] ;
++dem[s[i]];
//cout << endl;
}
else {
//cout << i << " " << s[i] << " " << dem[s[i]];
//cout << endl;
++m;
check[s[i]]=true;
++dem[s[i]];
c[m]=s[i];
}
}
for (int i=1;i<=m;i++) cout << c[i] << ": " << dem[c[i]] << endl;
}
CiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPHN0cmluZy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwojZGVmaW5lIE1BWCAzMDAKCnZvaWQgRGVtS3lUdShjaGFyIHNbXSk7CmludCBteVN0cmNtcChjaGFyIHMxW01BWF0sIGNoYXIgczJbTUFYXSk7CmludCBteVN0cmxlbihjaGFyIHNbXSwgaW50IGspOwoKaW50IG1haW4oKQp7CgljaGFyIHNbTUFYXTsKCS8vZ2V0cyhzKTsJLy9OaGFwIGNodW9pIHMJCgljaW4uZ2V0bGluZShzLE1BWCk7CglpZiAobXlTdHJjbXAocywgIiIpID09IDApCgkJY291dCA8PCAiQ2h1b2kgcm9u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