Language: C++

#include <algorithm>
using namespace std;

int main(){
	int n;
	cin >> n;
	string date1[36],date2[36];
	for(int i = 0; i < n; i++){
		cin >> date1[i];
		date2[i] = date1[i];
	}

	for(int i = 0; i < n; i++)
        for(int j = n -1; j > i; j--)
            if(date1[j-1][1] > date1[j][1])
                swap(date1[j-1],date1[j]);
    
	for(int i = 0; i < n - 1; i++){
        int min = i;
        for(int j = i + 1; j < n; j++)
            if(date2[min][1] > date2[j][1])
                min = j;
        
        if(min != i) 
            swap(date2[i],date2[min]);
    }
 
	for(int i = 0; i < n - 1; i++) cout << date1[i] << " "; cout << date1[n-1] << endl;
	cout << "Stable" << endl;
	for(int i = 0; i < n - 1; i++) cout << date2[i] << " "; cout << date2[n-1] << endl;
	int flag = 0;
	for(int i = 0; i < n; i++)
		if(date1[i] != date2[i]){flag++; break;}

	if(!flag) cout << "Stable";
	else cout << "Not stable";
	cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |         cin >> n;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <algorithm>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:7:9: error: 'string' was not declared in this scope
    7 |         string date1[36],date2[36];
      |         ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    1 | #include <algorithm>
  +++ |+#include <string>
    2 | using namespace std;
a.cc:9:24: error: 'date1' was not declared in this scope
    9 |                 cin >> date1[i];
      |                        ^~~~~
a.cc:10:17: error: 'date2' was not declared in this scope
   10 |                 date2[i] = date1[i];
      |                 ^~~~~
a.cc:15:16: error: 'date1' was not declared in this scope
   15 |             if(date1[j-1][1] > date1[j][1])
      |                ^~~~~
a.cc:21:16: error: 'date2' was not declared in this scope
   21 |             if(date2[min][1] > date2[j][1])
      |                ^~~~~
a.cc:25:18: error: 'date2' was not declared in this scope
   25 |             swap(date2[i],date2[min]);
      |                  ^~~~~
a.cc:28:40: error: 'cout' was not declared in this scope
   28 |         for(int i = 0; i < n - 1; i++) cout << date1[i] << " "; cout << date1[n-1] << endl;
      |                                        ^~~~
a.cc:28:40: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:28:48: error: 'date1' was not declared in this scope
   28 |         for(int i = 0; i < n - 1; i++) cout << date1[i] << " "; cout << date1[n-1] << endl;
      |                                                ^~~~~
a.cc:28:65: error: 'cout' was not declared in this scope
   28 |         for(int i = 0; i < n - 1; i++) cout << date1[i] << " "; cout << date1[n-1] << endl;
      |                                                                 ^~~~
a.cc:28:65: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:28:73: error: 'date1' was not declared in this scope
   28 |         for(int i = 0; i < n - 1; i++) cout << date1[i] << " "; cout << date1[n-1] << endl;
      |                                                                         ^~~~~
a.cc:28:87: error: 'endl' was not declared in this scope
   28 |         for(int i = 0; i < n - 1; i++) cout << date1[i] << " "; cout << date1[n-1] << endl;
      |                                                                                       ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <algorithm>
  +++ |+#include <ostream>
    2 | using namespace std;
a.cc:30:48: error: 'date2' was not declared in this scope
   30 |         for(int i = 0; i < n - 1; i++) cout << date2[i] << " "; cout << date2[n-1] << endl;
      |                                                ^~~~~
a.cc:30:73: error: 'date2' was not declared in this scope
   30 |         for(int i = 0; i < n - 1; i++) cout << date2[i] << " "; cout << date2[n-1] << endl;
      |                                                                         ^~~~~