mirror of
https://github.com/wczffl-503/OI-Codes.git
synced 2025-07-07 18:06:58 +08:00
Add FZOI Codes
This commit is contained in:
23
FZOI/过滤多余的空格 .cpp
Normal file
23
FZOI/过滤多余的空格 .cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
char ch;
|
||||
int space = 0;
|
||||
while(ch != '\n')
|
||||
{
|
||||
ch = getchar();
|
||||
if(ch == ' ' && space == 0)
|
||||
{
|
||||
putchar(ch);
|
||||
space = 1;
|
||||
}
|
||||
if(ch != ' ')
|
||||
{
|
||||
space = 0;
|
||||
putchar(ch);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user