Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
	string s;
	cin >> s;
	deque<char> dq;
	deque<char> :: iterator it;
	int q;
	cin >> q;
	int l = s.size();
	for(int i = 0; i < l; i++)
		dq.push_back(str[i]);
	bool f = false;
	int t, c;
	char s;
	for(int i = 0; i < q; i++){
		scanf("%d",&t);
		if(t == 1) f = !f;
		else if(t == 2){
			scanf("%d %c", &c, &s);
			if(!f){
				if(c == 1) dq.push_front(s);
				else if(c == 2) dq.push_back(s);
			}
			else {
				if(c == 2) dq.push_front(s);
				else if(c == 1) dq.push_back(s);				
			}
		}
	}
	if(!f){
		for(it = dq.begin(); it != dq.end(); it++)
			printf("%c", *it);		
	}
	else{
		for(it = dq.end() - 1; it != dq.begin() - 1; it--)
			printf("%c", *it);			
	}
	printf("\n");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:30: error: 'str' was not declared in this scope; did you mean 'std'?
   14 |                 dq.push_back(str[i]);
      |                              ^~~
      |                              std
a.cc:17:14: error: conflicting declaration 'char s'
   17 |         char s;
      |              ^
a.cc:6:16: note: previous declaration as 'std::string s'
    6 |         string s;
      |                ^
a.cc:24:57: error: no matching function for call to 'std::deque<char>::push_front(std::string&)'
   24 |                                 if(c == 1) dq.push_front(s);
      |                                            ~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/deque:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:139,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_deque.h:1501:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_front(const value_type&) [with _Tp = char; _Alloc = std::allocator<char>; value_type = char]'
 1501 |       push_front(const value_type& __x)
      |       ^~~~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1501:36: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const std::deque<char>::value_type&' {aka 'const char&'}
 1501 |       push_front(const value_type& __x)
      |                  ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_deque.h:1516:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_front(value_type&&) [with _Tp = char; _Alloc = std::allocator<char>; value_type = char]'
 1516 |       push_front(value_type&& __x)
      |       ^~~~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1516:31: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::deque<char>::value_type&&' {aka 'char&&'}
 1516 |       push_front(value_type&& __x)
      |                  ~~~~~~~~~~~~~^~~
a.cc:25:61: error: no matching function for call to 'std::deque<char>::push_back(std::string&)'
   25 |                                 else if(c == 2) dq.push_back(s);
      |                                                 ~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_deque.h:1538:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = char; _Alloc = std::allocator<char>; value_type = char]'
 1538 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1538:35: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const std::deque<char>::value_type&' {aka 'const char&'}
 1538 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_deque.h:1553:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = char; _Alloc = std::allocator<char>; value_type = char]'
 1553 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1553:30: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::deque<char>::value_type&&' {aka 'char&&'}
 1553 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:28:57: error: no matching function for call to 'std::deque<char>::push_front(std::string&)'
   28 |                                 if(c == 2) dq.push_front(s);
      |                                            ~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_deque.h:1501:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_front(const value_type&) [with _Tp = char; _Alloc = std::allocator<char>; value_type = char]'
 1501 |       push_front(const value_type& __x)
      |       ^~~~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1501:36: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const std::deque<char>::value_type&' {aka 'const char&'}
 1501 |       push_front(const value_type& __x)
      |                  ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_deque.h:1516:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_front(value_type&&) [with _Tp = char; _Alloc = std::allocator<char>; value_type = char]'
 1516 |       push_front(value_type&& __x)
      |       ^~~~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1516:31: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::deque<char>::value_type&&' {aka 'char&&'}
 1516 |       push_front(value_type&& __x)
      |                  ~~~~~~~~~~~~~^~~
a.cc:29:61: error: no matching function for call to 'std::deque<char>::push_back(std::string&)'
   29 |                                 else if(c == 1) dq.push_back(s);
      |                                                 ~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_deque.h:1538:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = char; _Alloc = std::allocator<char>; value_type = char]'
 1538 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1538:35: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const std::deque<char>::value_type&' {aka 'const char&'}
 1538 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_deque.h:1553:7: note: candidate: 'void std::deque<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = char; _Alloc = std::allocator<char>; value_type = char]'
 1553 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_deque.h:1553:30: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::deque<char>::value_type&&' {aka 'char&&'}
 1553 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~