View Code of Problem 114

include<stdio.h>
#include<string.h>
int main()
{
    char s[1000];
    int i,j,k;
    while(gets(s)){
    for(i=0;i<strlen(s);i++)
    {k=0;
        if(s[i]<='z'&&s[i]>='a'||s[i]<='Z'&&s[i]>='A')
        {
           for(j=i;j<strlen(s);j++)
           {
               if(s[j]<='z'&&s[j]>='a'||s[j]<='Z'&&s[j]>='A')
                    k++;
                else
                    break;
           }
           for(j=i+k-1;j>=i;j--)
           {
               printf("%c",s[j]);
           }
           i=i+k-1;
        }
        else
        {
            printf("%c",s[i]);
        }
    }
    }
    return 0;
}

/*
Main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
 include<stdio.h>
        ^
In file included from Main.c:2:0:
/usr/include/string.h:47:8: error: unknown type name 'size_t'
        size_t __n) __THROW __nonnull ((1, 2));
        ^
/usr/include/string.h:50:56: error: unknown type name 'size_t'
 extern void *memmove (void *__dest, const void *__src, size_t __n)
                                                        ^
/usr/include/string.h:66:42: error: unknown type name 'size_t'
 extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
                                          ^
/usr/include/string.h:69:56: error: unknown type name 'size_t'
 extern int memcmp (const void *__s1, const void *__s2, size_t __n)
                                                        ^
/usr/include/string.h:96:48: error: unknown type name 'size_t'
 extern void *memchr (const void *__s, int __c, size_t __n)
                                                ^
/usr/include/string.h:133:39: error: unknown type name 'size_t'
         const char *__restrict __src, size_t __n)
                                       ^
/usr/include/string.h:141:9: error: unknown type name 'size_t'
         size_t __n) __THROW __nonnull ((1, 2));
         ^
/usr/include/string.h:147:57: error: unknown type name 'size_t'
 extern int strncmp (const char *__s1, const char *__s2, size_t __n)
                                                         ^
/usr/include/string.h:154:8: error: unknown type name 'size_t'
 extern size_t strxfrm (char *__restrict __dest,
        ^
/usr/include/string.h:155:40: error: unknown type name 'size_t'
          const char *__restrict __src, size_t __n)
                                        ^
/usr/include/string.h:285:8: error: unknown type name 'size_t'
 extern size_t strcspn (const char *__s, const char *__reject)
        ^
/usr/include/string.h:289:8: error: unknown type name 'size_t'
 extern size_t strspn (const char *__s, const char *__accept)
        ^
/usr/include/string.h:399:8: error: unknown type name 'size_t'
 extern size_t strlen (const char *__s)
        ^
/usr/include/string.h:451:33: error: unknown type name 'size_t'
 extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1));
                                 ^
Main.c: In function 'main':
Main.c:7:5: warning: implicit declaration of function 'gets' [-Wimplicit-function-declaration]
     while(gets(s)){
     ^
Main.c:10:21: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
         if(s[i]<='z'&&s[i]>='a'||s[i]<='Z'&&s[i]>='A')
                     ^
Main.c:14:28: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
                if(s[j]<='z'&&s[j]>='a'||s[j]<='Z'&&s[j]>='A')
                            ^
Main.c:21:16: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
                printf("%c",s[j]);
                ^
Main.c:21:16: warning: incompatible implicit declaration of built-in function 'printf'
Main.c:27:13: warning: incompatible implicit declaration of built-in function 'printf'
             printf("%c",s[i]);
             ^
*/

Double click to view unformatted code.


Back to problem 114