#include <iostream>
usingnamespace std;
int main()
{
char word[100];
int count[100];
int count2[100];
//Basic I/O
cout<<"Enter the word: ";
gets(word);
//To initialize to 0
for(int i=0; i <= 100; i++)
{
count[i] = 0;
count2[i] = 0;
}
//For getting the count of uppercase letters
for(int i=0; i <= 100; i++)
{
for(int j=0; j <= 100; j++)
{
if(word[i] == char(65+j))
{
count[j]+=1;
}////////// END //////////
}////////// END //////////
}////////// END //////////
//For getting the count of lowercase letters
for(int i=0; i <= 100; i++)
{
for(int j=0; j <= 100; j++)
{
if(word[i] == char(97+j))
{
count2[j]+=1;
}////////// END //////////
}////////// END //////////
}////////// END //////////
//Output of individual uppercase. If letter is == 0, will not output letter.
for(int i=0; i <= 100; i++)
{
if(count[i] != 0)
{
cout<<char(65+i)<<" = "<<count[i]<<"\t";
}////////// END //////////
}////////// END //////////
cout<<endl<<endl;
//Output for individual lowercase. If letter is ==0, will not output letter.
for(int i=0; i <= 100; i++)
{
if(count2[i] != 0)
{
cout<<char(97+i)<<" = "<<count2[i]<<"\t";
}////////// END //////////
}////////// END //////////
cin.get();
return 0;
}
//To initialize to 0
for(int i=0; i <= 100; i++)
{
count[i] = 0;
count2[i] = 0;
}
for(int i=0; i <= 100; i++)
{
if(isupper(word[i]))
count[i]+=1;
if(islower(word[i]))
count2[i]+=1;
}
//Output of individual uppercase. If letter is == 0, will not output letter.
for(int i=0; i < 25; i++)
{
if(word[i] != 0)
cout<<char(65+i)<<" = "<<count[i]<<"\t";
////////// END //////////
}////////// END //////////
cout<<endl<<endl;
//Output for individual lowercase. If letter is ==0, will not output letter.
for(int i=0; i < 25; i++)
{
if(word[i] != 0
cout<<char(97+i)<<" = "<<count2[i]<<"\t";
////////// END //////////
}////////// END //////////
cin.get();
return 0;