编写函数expand(s1,s2),将字符串s1中类似于a-z一类的速记符在字符串s2中扩展为等价的完整列表:abc...xyz。该函数可以处理大小写和数字,并可以处理a-b-c,a-z0-9等类似情况,作为前导和尾随的字符原样输出
expand(char s1[],char s2[]){ int i,j; char c; i=j=0; while((c=s1[i++])!='\0'){ if(s1[i]=='-'&&s1[i+1]>=c){ i++; while(c<s1[i]){ s2[j++] = c++; } }else{ s2[j++] = c; } } s2[j] = '\0'; }