#include
using namespace std;
int main()
{
//Initializing variable.
char str[100];
int i, j;
//Accepting input.
cout<<"Enter a string : ";
gets(str);
//Iterating each character and removing non alphabetical characters.
for(i = 0; str[i] != ' '; ++i)
{
while (!( (str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z') || str[i] == ' ') )
{
for(j = i; str[j] != ' '; ++j)
{
str[j] = str[j+1];
}
str[j] = ' ';
}
}
//Printing output.
cout<<"After removing non alphabetical characters the string is :";
puts(str);
return 0;
}