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";
		sin >> command;
		if (strcmp(command, "insert") == 0) {
			list.insertNode(cin);
		} else if (strcmp(command, "delete") == 0) {
			list.deleteNode(cin);
		} else if (strcmp(command, "deleteFirst") == 0) {
			list.deleteFirst();
		} else {
			list.deleteLast();
		}
	}

	list.print();
	
	return 0;
}

Compiler output:
a.cc: In member function 'void LinkedList::deleteFirst()':
a.cc:105:48: error: request for member 'getNext' in '((LinkedList*)this)->LinkedList::p_dummy->Node::getNext()', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
  105 |         linkNode(p_dummy, (*p_dummy).getNext().getNext());
      |                                                ^~~~~~~
a.cc: In member function 'void LinkedList::deleteLast()':
a.cc:110:39: error: request for member 'getPrev' in '((LinkedList*)this)->LinkedList::p_dummy->Node::getPrev()', which is of pointer type 'Node*' (maybe you meant to use '->' ?)
  110 |         linkNode((*p_dummy).getPrev().getPrev(), p_dummy);
      |                                       ^~~~~~~
a.cc: In function 'int main()':
a.cc:139:17: error: 'sin' was not declared in this scope
  139 |                 sin >> command;
      |                 ^~~
a.cc:141:41: error: cannot convert 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
  141 |                         list.insertNode(cin);
      |                                         ^~~
      |                                         |
      |                                         std::istream {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:143:41: error: cannot convert 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
  143 |                         list.deleteNode(cin);
      |                                         ^~~
      |                                         |
      |                                         std::istream {aka std::basic_istream<char>}
a.cc:92:33: note:   initializing argument 1 of 'void LinkedList::deleteNode(int)'
   92 | void LinkedList::deleteNode(int x)
      |                             ~~~~^