题目描述
输入一行字符,分别归类出其中英文字母、空格、数字和其他字符,并分别按字母、空格、数字、其他字符输出。
要求:字母、数字字符要排序;空格的首尾用*标志;不删除重复字符。
输入
输入一行字符,分别归类出其中英文字母、空格、数字和其他字符,并分别按字母、空格、数字、其他字符输出。
输出
要求:字母、数字字符要排序;空格的首尾用*标志;不删除重复字符。
样例输入
12 sd w$%^. ,/';\'adfw
样例输出
addfsww
* *
12
$%^.,/';\'
参考代码
#include <stdio.h>
#include <string.h>
#define MAXSIZE 100
char s[MAXSIZE];
char s1[MAXSIZE],s2[MAXSIZE],s4[MAXSIZE];
int s3;
void deal()
{
int i,j=0,k=0,count=0;
s3=0;
for (i=0;i<=(signed)strlen(s);i++)
{
if((s[i]>=65&&s[i]<=90)||(s[i]>=97&&s[i]<=122))
s1[j++]=s[i]; else
if(s[i]>='0'&&s[i]<='9')
s2[k++]=s[i]; else
if(s[i]==' ')
s3++; else
s4[count++]=s[i];
}
s1[j]='