fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. string s;
  7. char c=97;
  8. int n=26;
  9. getline(cin, s);
  10. while(n>0)
  11. {
  12. int i=0,cnt=0;
  13. for(int i=0;i<s.length();i++)
  14. {
  15. s[i]=tolower(s[i]);
  16. if(s[i]==c)
  17. cnt++;
  18. }
  19. if(c==123)
  20. cout<<c<<":"<<cnt;
  21. else
  22. cout<<c<<":"<<cnt<<"\n";
  23. c++;
  24. n--;
  25. }
  26. return 0;
  27. }
Success #stdin #stdout 0s 4524KB
stdin
This is a pen. Zz
stdout
a:1
b:0
c:0
d:0
e:1
f:0
g:0
h:1
i:2
j:0
k:0
l:0
m:0
n:1
o:0
p:1
q:0
r:0
s:2
t:1
u:0
v:0
w:0
x:0
y:0
z:2