#include<stdio.h> int iszhimu(char x){ if((x>='a'&&x<='z')||(x>='A'&&x<='Z')) return 1; else return 0; } int main() { char a[100]; int m,n,i,j,k; char temp; int t=0; for(;gets(a)!=NULL;) { for(i=0;a[i]!='\0';) { for(;iszhimu(a[i])==1;) t++; m=t; for(;iszhimu(a[i])==1;) t++; n=t-1; for(j=m,k=0;j<=(m+n)/2;j++,k++) { temp=a[j];a[j]=a[n-k];a[n-k]=temp; } } } puts(a); } |
Double click to view unformatted code.