strncpy
#include <stdio.h>
#include <string.h>
int main(){
char str[100];
int k;
while(scanf("%s",str)!=EOF){
scanf("%d",&k);
char output[100]={'\0'};
strncpy(output,str,k);
printf("%s\n",output);
}
return 0;
}
strncpy
#include <stdio.h>
#include <string.h>
int main(){
char str[100];
int k;
while(scanf("%s",str)!=EOF){
scanf("%d",&k);
char output[100]={'\0'};
strncpy(output,str,k);
printf("%s\n",output);
}
return 0;
}