#include <stdio.h>
#define MAXCHAR 1024
#define LIMIT 10
int getline(char array[], int n);
void fold(char from[], char temp[], int m);
int main(void){
int i;
char line[MAXCHAR];
char temp[MAXCHAR];
i=0;
while((i = getline(line, MAXCHAR)) > 0){
fold(line, temp, i);
printf("\nLine #1: %s\n", line);
printf("\nLine #2: %s\n", temp);
printf("\nLine #1 size: %d\n", i);
printf("\nEND\n");
}
return 0;
}
int getline(char a[], int max){
int c, i;
for(i = 0; i < MAXCHAR - 1 && (c=getchar()) != EOF && c != '\n'; i++){
a[i] = c;
}
a[i] = '\0';
return i;
}
void fold(char from[], char temp[], int size){
int a, b, c, d, i, j;
a=b=j=0;
d=10;
for(i=0; i<size; i++){
if(i!=size && c==0){
c=1;
d=d+LIMIT;
//printf("\n%s", temp);
printf("i!=size && c==0 OK\n");
printf("i = %d\n", i);
printf("c = %d\n", c);
printf("d = %d\n", d);
}
if(i!=size && c==1){
c=0;
//j=LIMIT;
//d=d+LIMIT;
//printf("\n%s", temp);
printf("i!=size && c==1 OK\n");
printf("i = %d\n", i);
printf("c = %d\n", c);
}
if(i<d && c==0){
//temp[i] = from[i];
printf("i<d && c==0 OK\n");
}
if(i<d && c==1){
//temp[j] = from[i];
//j--;
printf("i<d && c==1 OK\n");
printf("i = %d\n", i);
printf("c = %d\n", c);
}
putchar('\n');
}
}