Skip to content

Instantly share code, notes, and snippets.

@mrcat323
Last active January 11, 2020 20:26
Show Gist options
  • Save mrcat323/6d5bd4b338b7b79f84040d3be291d81e to your computer and use it in GitHub Desktop.
Save mrcat323/6d5bd4b338b7b79f84040d3be291d81e to your computer and use it in GitHub Desktop.
Fold task
#include <stdio.h>
int main(void)
{
char t;
int n;
int pc, c, nc, nw;
// scanf("%d", &n);
n = 10;
nc = nw = 0;
while ((c = getchar()) != EOF) {
if (nc != 0 && nc % n == 0) {
/* abdurahmon hasanov */
if (c == ' ' || c == '\t' || c == ',' || c == '.' || c == ';' || c == ':')
putchar('\n');
else if (c != ' ') {
putchar(c);
continue;
}
}
putchar(c);
++nc;
pc = c;
if (c == '\n')
nc = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment