#include <stdio.h> int main(){ int x[26] = { 0, }; int index; char string[10] = "abcdef"; for (int i = 0; i < 10; i++) { index = string[i] - 97; x[index]++; } for (int i = 0; i < 26; i++) { printf("%c : %d\n", i+97, x[i]); } return 0;}
Standard input is empty
a : 1 b : 1 c : 1 d : 1 e : 1 f : 1 g : 0 h : 0 i : 0 j : 0 k : 0 l : 0 m : 0 n : 0 o : 0 p : 0 q : 0 r : 0 s : 0 t : 0 u : 0 v : 0 w : 0 x : 0 y : 0 z : 0
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!