#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <math.h>


int main(int argc, char *argv[]) {
    FILE *ti = fopen(argv[1], "r");
    FILE *ki = fopen(argv[2], "r");
    if(ti == NULL || ki == NULL) {
        printf("Ne vnesovte validni datoteki! Probajte povtorno!\n");
        return 0;
    }
    char niza[1000];
    while(fgets(niza, 500, ti)) {
        int x;
        fscanf(ki, "%d", &x);
        if(strlen(niza) < x) {
            printf("\n");
        }
        else {
            for(int i = 0; i < x; i++) {
                printf("%c", niza[i]);
            }
            printf("\n");
        }
    }
    return 0;
}
/*
 
 **/
