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