#include<stdio.h
#include<string.h
int main()
{
int i,j=0;
char ch[256];
char th[256];
gets(ch);
int len=strlen(ch);
for(i=0;i<len;i++)
{
if(ch[i]!=" ")
{
th[j]=ch[i];
j++;
}
else if(ch[i+1]!=" ") th[j]=ch[i];
j++;
}
printf("%s",th);
return 0;
}
我的代码无法实现过滤多余空格的操作
输入Hello world.This is c language.
只能出来个.
哪里出现了问题