Remove Characters in the given String Except Alphabets Test Case 1 Input (stdin) t28lkj Expected Output tlkj Test Case 2 Input (stdin) [email protected]/@@@@@@@@@@@ Expected Output programiz
#include<stdio.h>
int main()
{
char line[150];
int i, j;
scanf ("%[^\n]s",line);
for(i = 0; line[i] != '\0'; ++i)
{
while (!( (line[i] >= 'a' && line[i] <= 'z') || (line[i] >= 'A' && line[i] <= 'Z') || line[i] == '\0') )
{
for(j = i; line[j] != '\0'; ++j)
{
line[j] = line[j+1];
}
line[j] = '\0';
}
}
puts(line);
return 0;
}