Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
37
Task/Odd-word-problem/C/odd-word-problem.c
Normal file
37
Task/Odd-word-problem/C/odd-word-problem.c
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static int
|
||||
owp(int odd)
|
||||
{
|
||||
int ch, ret;
|
||||
ch = getc(stdin);
|
||||
if (!odd) {
|
||||
putc(ch, stdout);
|
||||
if (ch == EOF || ch == '.')
|
||||
return EOF;
|
||||
if (ispunct(ch))
|
||||
return 0;
|
||||
owp(odd);
|
||||
return 0;
|
||||
} else {
|
||||
if (ispunct(ch))
|
||||
return ch;
|
||||
ret = owp(odd);
|
||||
putc(ch, stdout);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int ch = 1;
|
||||
while ((ch = owp(!ch)) != EOF) {
|
||||
if (ch)
|
||||
putc(ch, stdout);
|
||||
if (ch == '.')
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue