Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <stdbool.h>
- /**
- * Auto-generated code below aims at helping you parse
- * the standard input according to the problem statement.
- **/
- char *substr(char const *input, size_t start, size_t len) {
- char *ret = malloc(len+1);
- memcpy(ret, input+start, len);
- ret[len] = '\0';
- return ret;
- }
- int main()
- {
- int N;
- scanf("%d", &N); fgetc(stdin);
- char TEXT[1000];
- scanf("%[^\n]", TEXT);
- for (int i=0; TEXT[i] != '\0'; i++) {
- char *s = substr(TEXT, i, N);
- printf("%s\n", s);
- if (i+N==strlen(TEXT)) break;
- free(s);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement