Language: C++

#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;

//
class Node {
private:
	int key;
	Node *p_next = NULL;
	Node *p_prev = NULL;
public:
	Node(int k);
	void linkNext(Node *n);
	void linkPrev(Node *n);
	Node *getNext();
	Node *getPrev();
	bool hasKey(int k);
	void printKey();
};

Node::Node(int k)
{
	key = k;
}

void Node::linkNext(Node *p_n)
{
	p_next = p_n;
}

void Node::linkPrev(Node *p_n)
{
	p_prev = p_n;
}

Node *Node::getNext()
{
	return p_next;
}

Node *Node::getPrev()
{
	return p_prev;
}

bool Node::hasKey(int k)
{
	return key == k;
}

void Node::printKey()
{
	cout << key;
}

//
class LinkedList {
private:
	Node *p_dummy;
	void linkNode(Node *p_n1, Node *p_n2);
public:
	LinkedList();
	void insertNode(int x);
	void deleteNode(int x);
	void deleteFirst();
	void deleteLast();
	void print();
};

LinkedList::LinkedList()
{
	Node n(-1);
	n.linkNext(&n);
	n.linkPrev(&n);
	p_dummy = &n;
}

void LinkedList::linkNode(Node *p_n1, Node *p_n2)
{
	(*p_n1).linkNext(p_n2);
	(*p_n2).linkPrev(p_n1);
}

void LinkedList::insertNode(int x)
{
	Node n(x);
	linkNode(&n, (*p_dummy).getNext());
	linkNode(p_dummy, &n);
}

void LinkedList::deleteNode(int x)
{
	Node *p_n = (*p_dummy).getNext();
	while (!(*p_n).hasKey(x)) {
		if ((*p_n).hasKey(-1)) return;
		p_n = (*p_n).getNext();
	}
	
	linkNode((*p_n).getPrev(), (*p_n).getNext());
}

void LinkedList::deleteFirst()
{
	linkNode(p_dummy, (*p_dummy).getNext()->getNext());
}

void LinkedList::deleteLast()
{
	linkNode((*p_dummy).getPrev()->getPrev(), p_dummy);
}

void LinkedList::print()
{
	Node *p_n = (*p_dummy).getNext();
	if ((*p_n).hasKey(-1)) return;
	while (1) {
		(*p_n).printKey();
		p_n = (*p_n).getNext();
		if ((*p_n).hasKey(-1)){
			cout << endl;
			break;
		} else {
			cout << " ";
		}
	}
}

//
int main(void)
{	
	LinkedList list;
	
	int n;
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		char command[12] = "\0";
		cin >> command;
		if (strcmp(command, "insert") == 0) {
			int key;
			list.insertNode(cin >> key);
		} else if (strcmp(command, "delete") == 0) {
			int key;
			list.deleteNode(cin >> key);
		} else if (strcmp(command, "deleteFirst") == 0) {
			list.deleteFirst();
		} else {
			list.deleteLast();
		}
	}

	list.print();
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:142:45: error: cannot convert 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int'
  142 |                         list.insertNode(cin >> key);
      |                                         ~~~~^~~~~~
      |                                             |
      |                                             std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:85:33: note:   initializing argument 1 of 'void LinkedList::insertNode(int)'
   85 | void LinkedList::insertNode(int x)
      |                             ~~~~^
a.cc:145:45: error: cannot convert 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int'
  145 |                         list.deleteNode(cin >> key);
      |                                         ~~~~^~~~~~
      |                                             |
      |                                             std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
a.cc:92:33: note:   initializing argument 1 of 'void LinkedList::deleteNode(int)'
   92 | void LinkedList::deleteNode(int x)
      |                             ~~~~^