Program to remove all characters in a string except alphabets

Program to remove all characters in a string except alphabets

A program to remove all characters in a string except alphabets is discussed here. Given a string, remove all the characters except alphabets and display it as output. For example, consider the following example

Program to remove all characters in a string except alphabets


Input and Output Format:

Input consists of a string. Assume the maximum length of the string is 200. The characters in the string can contain both uppercase, lowercase, and symbols.


Sample Input:

pro$#&gra7m


Sample Output:

program

Algorithm to remove all characters in a string except alphabets

  • Input the string from the user.
  • Traverse the string, character by character.
  • If the character is not an alphabet, do not add it to the resultant string.
  • If the character is an alphabet, add it to the resultant string.
  • Print the string.


face prep ad bannerClick here to learn more about FACE Prep PRO


Program to remove all characters in a string except alphabets

@@coding::2@@


Recommended Programs



Program to remove all characters in a string except alphabets

c