Final answer:
To remove all non-alpha characters from a given input, write a program that iterates over each character and checks if it is alphabetic or not. Then, append alphabetic characters to a new string and return it.
Step-by-step explanation:
To remove all non-alpha characters from a given input, you can write a program that iterates over each character in the input and checks if it is an alphabetic character or not. If it is an alphabetic character, you append it to a new string. Here's an example program in Python:
def remove_non_alpha(input_string):
alpha_string = ''
for char in input_string:
if char.isalpha():
alpha_string += char
return alpha_string
input_string = input('Enter a string: ')print(remove_non_alpha(input_string))
This program takes user input and uses the isalpha() method to check if each character is alphabetic or not. If it is alphabetic, it appends it to the alpha_string. Finally, it returns the alpha_string without any non-alpha characters. For the given input '-Hello, 1 world$!', the output will be 'Helloworld'.