View Code of Problem 114

#include<stdio.h>
#include<string.h>

int main()
{
  int i,n,j,temp;
  char a[1000];
  while(scanf("%s",a)!=NULL)
  {
    n=strlen(a);
    for(i=0;i<n;i++)
    {
      if(a[i]>='a'&&a[i]=<'z'||a[i]>='A'&&a[i]<='Z')
      {
        temp=i;
        while(a[i+1]>='a'&&a[i+1]<='z'||a[i+1]>='A'&&a[i+1]<='Z') i++;
        for(j=i;j>=temp;j--)
          printf("%c",a[j]);
      }
      else 
        printf("%c",a[i]);
    }
    printf("\n");
  }
}
/*
Main.c: In function 'main':
Main.c:8:22: warning: comparison between pointer and integer
   while(scanf("%s",a)!=NULL)
                      ^~
Main.c:13:26: error: expected expression before '<' token
       if(a[i]>='a'&&a[i]=<'z'||a[i]>='A'&&a[i]<='Z')
                          ^
Main.c:16:26: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
         while(a[i+1]>='a'&&a[i+1]<='z'||a[i+1]>='A'&&a[i+1]<='Z') i++;
               ~~~~~~~~~~~^~~~~~~~~~~~~
*/

Double click to view unformatted code.


Back to problem 114