Guest User

Count each char in a String

a guest
Jan 5th, 2011
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Count char by FamiHug 05.01.2011 14:13:09
  2. //Ver 1.0 chi nhap chu cai IN HOA VD: ABEAVDFSDEF
  4. #include <stdio.h>
  6. int main()
  7. {
  8.     int i,temp;
  9.     int cntr[26]={0};
  10.     while((temp=getchar())!='\n')
  11.         cntr[(temp-'A')]++;
  12.     for(i=0;i<26;i++)
  13.         if(cntr[i]>0) printf("%c_%d ",i+'A',cntr[i]);
  14.     return 0;
  15. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add to your ad blocker whitelist or disable your adblocking software.