Remove all characters except alphabets

Description:

Write a simple C++ program to remove all special characters and numbers except Alphabets from the given string Test Case 1 Input (stdin) C*kl/d Expected Output Ckld Test Case 2 Input (stdin) h#E))L= Expected Output hEL

Program :

#include <iostream>
using namespace std;
int main() {
    string line;
   
    getline(cin, line);
    for(int i = 0; i < line.size(); ++i)
    {
        if (!((line[i] >= 'a' && line[i]<='z') || (line[i] >= 'A' && line[i]<='Z')))
        {
            line[i] = '\0';
        }
    }
    cout <<  line;    
    return 0;
}