#include <stdio.h> #include <stdlib.h> typedef struct{ int data; struct list* next; }list; int main() { int n,x; scanf("%d %d",&n,&x); list* arr=(list*)malloc(sizeof(list)); arr->next = NULL; list* head=arr; for (int i = 0; i < n; i++) { list* p=(list*)malloc(sizeof(list)); scanf("%d",&(p->data)); p->next=NULL; head->next=p; head=p; } list* last=arr; head=arr->next; while(head) { if(head->data == x) last->next = head->next; else last=last->next; head=head->next; } head=arr->next; while(head) { printf("%d ",head->data); head=head->next; } free(arr); return 0; }