// editor4
#include<stdio.h>
#include<stdlib.h>
struct node{
    int data;
    struct node*next;
};
struct node* createnode(int value){
    struct node*newnode =(struct node*)malloc(size of struct (node));
    newnode->data=value;
    newnode->next=NULL;
    return newnode;
}
void deletelastk(struct node** head,int k){
    int len =0;
    struct node*temp=*head;
    while (temp!=NULL){
        len++;
        temp=temp->next;
    }
    if(k >len){
        printf("Invalid input\n");
        return ;
    }
    if(k== len){
        printf("List iss empty\n");
        return ;
    }
    int stop =len -k;
    temp=*head;
    for(int i=1;i<stop;i++){
        temp=teemp->next;
    }
    struct node*del =temp->next;
    temp->next=NULL;
    while (del !=NULL){
        struct node*t = del;
        del=del->next;
        free(t);
        
    }
    temp=*head;
    while(temp !=NULL){
        printf("%d", temp->data);
        if(temp->next!= NULL)printf(" ");
        temp temp->next
    }
}