#include<stdio.h>
#include<stdlib.h>
struct Node {
   int data;
   struct Node*next;
   };
   struct Node*createNode(int value) {
   struct Node*newNode = (struct Node*)malloc
   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 is empty\n");
   return;
   }
   int stop = len -k;
   temp = *head;
   for (int i = 1; i < stop; i++) {
   temp = temp->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;
   }
   printf("\n");
   }