Friday, August 17, 2018

SYMBOLS FILTER

  • Problem Description

    Ganga found a diary, she cant understand what is written in it. Because the letters are mingled with special symbols. She needs to filter those letters to read that diary. can you help her?
  • CODING ARENA
  • #include <stdio.h>
    #include<string.h>
    int main()
    {
      char line[150];
      int i,j;
      scanf("%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';
        }
      }
      printf("%s",line);
      return 0;
    }
                
                
                  
  • Test Case 1

    Input (stdin)
    pass@word
    
    
    Expected Output
    password
  • Test Case 2

    Input (stdin)
    wel$co*me
    
    
    Expected Output
    welcome

No comments:

Post a Comment