blob: 73ea49946619ae28194fadad09a9a9454579535e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#print
Write a program to copy its input to its output,
replacing each string of one or more blanks by
a single blank.
#once #create Ref
This has lines with several blanks
including some in funny places.
#once #create Ref1
#once #create Answer
This has lines with several blanks
including some in funny places.
#user
a.out <Ref >test
a.out <Ref1 >>test
#cmp test Answer
#succeed
One way:
#include <stdio.h>
main()
{
int c;
for (c = getchar(); c != EOF; ) {
putchar(c);
if (c == ' ')
while ((c = getchar()) == ' ')
;
else
c = getchar();
}
}
#log
#next
9.1a 10
|