改如下,你对照看:
#include "stdio.h"int main(void){ char s[100],a[50],b[50]; int i,j,k; gets(s); for(j=k=i=0;s[i]!='\0';i++) if(s[i]>='a' && s[i]<='z' || s[i]>='A' && s[i]<='Z') a[j++]=s[i]; else b[k++]=s[i]; a[j]=b[k]='\0'; puts(a); puts(b); return 0;}