#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; //换; } } for(i=0;i<len;i++) { if(i<len-1)printf("%c",s[i]); else printf("%c\n",s[i]); } } return 0; } |
Double click to view unformatted code.