#include<stdio.h> #include<string.h> int main() { int i,n,j,temp; char a[1000]; while(gets(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"); } } |
Double click to view unformatted code.