问题 5668 --过滤字符串中的空格

5668: 过滤字符串中的空格★★

时间限制: 1 Sec  内存限制: 128 MB
提交: 417  解决: 172
[提交][状态][命题人:]

题目描述

小明喜欢从网上复制一些金句保存在word中,但是每次复制时会带来大量的空格让他觉得不开心。请你帮小明编写一个程序用于过滤空格,将连续的空格用一个空格代替。

输入

第一行包含1个整数(1n100)表示要处理的行数。

接下来的 n 行中的每一行都包含一个字符串。

输出

输出过滤空格后的字符串,连续的空格用1个空格代替

样例输入
Copy
4
To     see a world     in a grain of sand,
    And a heaven in a wild flower,
Hold    infinity    in the palm of your hand,
And eternity in an hour    .
样例输出
Copy
To see a world in a grain of sand,
And a heaven in a wild flower,
Hold infinity in the palm of your hand,
And eternity in an hour .

提示

来源

[提交][状态]