1087:去掉空格

来源:互联网 发布:学设计软件机构 编辑:程序博客网 时间:2024/06/09 19:07

1087:去掉空格


Description


读入一些字符串,将其中的空格去掉。


Input


输入为多行,每行为一个字符串,字符串只由字母,数字和空格组成,长度不超过80.请处理到文件末尾。


Output


对于每行输入,输出转换后的字符串。


Sample Input


Hello World

1 2 3

Nice to meet you

abc


Sample Output


HelloWorld

123

Nicetomeetyou

abc


HINT


用scanf是不能读入一行有空格的字符串的,用"gets(str)!=NULL"可以判断输入是否结束,如果此条件为假(即gets(str)==NULL),则表示输入结束(对于本题)。


#include<stdio.h>#include<string.h>int main(){    char ch[10000];    int i,n;   while(gets(ch))    {    n=strlen(ch);    for(i=0;i<n;i++)    {        if(ch[i]!='\40')            printf("%c",ch[i]);    }    printf("\n");    }   return 0;   }