fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. int i, f;
  8. string t;
  9. cin >> i >> f;
  10. cin.ignore(); // Ignorar el salto de lĂ­nea
  11. getline(cin, t);
  12. int c[26] = {};
  13. for (int j = i; j < t.size() && j <= f; j++) {
  14. char l = tolower(t[j]);
  15. if (l >= 'a' && l <= 'z') c[l - 'a']++;
  16. }
  17. for (char l = 'a'; l <= 'z'; l++) cout << l << ": " << c[l - 'a'] << endl;
  18. return 0;
  19. }
Success #stdin #stdout 0s 5284KB
stdin
0 3
hola chicos
stdout
a: 1
b: 0
c: 0
d: 0
e: 0
f: 0
g: 0
h: 1
i: 0
j: 0
k: 0
l: 1
m: 0
n: 0
o: 1
p: 0
q: 0
r: 0
s: 0
t: 0
u: 0
v: 0
w: 0
x: 0
y: 0
z: 0