#include<stdio.h> #include<string.h> #include<ctype.h> int main(){ int i,j,n,m,len; char s[100],t; while(gets(s)) { len=strlen(s); i=0; n=0; while(s[i]!='\0') { while( !isalpha(s[i])) i++; n=i; while(isalpha(s[i])) i++; m=i-1; for(j=n;j<=(m+n)/2;j++) { t=s[j];s[j]=s[n+m-j];s[n+m-j]=t; } } puts(s); } return 0; } |
Double click to view unformatted code.