Language: C++

#include <bits/stdc++.h>
#define int long long int
#define F first
#define S second

using namespace std ;

const int N = 3000 + 100 ;
string s , t ;
pair<int ,pair <int , int>> dp[N][N] ;

int32_t main(){
	cin >> s >> t ;
	int n = s.size() , m = t.size() ;
	for(int i = 1 ; i <= n ; i++)
		for(int j = 1 ; j <= m ; j++)
			if(s[i - 1] == t[j - 1]){
				dp[i][j].F = dp[i - 1][j - 1].F + 1;
				dp[i][j].S.F = i - 1 ;
				dp[i][j].S.S = j - 1 ;
			}else{
				dp[i][j].F = (dp[i - 1][j].F > dp[i][j - 1].F ? dp[i - 1][j].F : dp[i][j - 1].F) ;
				dp[i][j].S.F = (dp[i - 1][j].F > dp[i][j - 1].F ? i - 1 : i) ;
				dp[i][j].S.S = (dp[i - 1][j].F > dp[i][j - 1].F ? j : j - 1) ;
			}
	string ans ;
	int l = n , r = m ;
	while(l && r){
		if(s[l - 1] == t[r - 1]){
			ans += s[l - 1] ;
		}
		int ll = dp[l][r].S.F ;
		int rr = dp[l][r].S.S ;
		l = ll;
		r = rr ;
	}
	revrese (ans.begin() , ans.end()) ;
	cout << ans ;
	return 0 ; 
}
/*
#include <radman/roderc++.h>
                     ....._____
                 .~~~~~////////\\                                                                                           ...
              .:::::////////////\\                                          ....::////////..                              (/\\\\...
           .::::://////   \\\\///\\              .:::://                ..:::::///////////////.                           \\\\\$$$$$$
         \\\\\//////      \\\\///\\           //\\\//////             \\\\\////////////////////.                           ""\\$$$$$$$
         \\\\\////         \\\\////         |||||////////.            \\\\\/////     ~~~~~//////          ...                  "\$$$$
         \\\\\//\         ////|||/          \\\\\/////////            \\\\\//\       ~~~~~//////        (/\\\\...                   .
         \\\\\//\        ////|||/          |||||////*\\///.           \\\\\//\       ~~~~~//////        \\\\\$$$$$$                 .@@@@@.
         \\\\\//\       ////|||/           \\\\\///|\\\////           \\\\\//\       ~~~~~//////         ""\\$$$$$$$               @@@@////\
         \\\\\//\ ____---/|||/            |||||///|\\\\\///.          \\\\\//\       ~~~~~//////             "\$$$$                @@@@\///\
         \\\\\//\--|||||||_-'             \\\\\///|\\\\\////          \\\\\//\       ~~~~~//////                                  ,@@@@|///|
         \\\\\//\|||||_"-\\\\\           |||||///|  ~~~~~///.         \\\\\//\      ~~~~~//////     .@@@@.                    /@@@@@|/////
         \\\\\//\///"""\\\\\\\\          \\\\\///|~~~~[[[////.        \\\\\//\     ~~~~~//////      @@@@@@@@                ..@@@@@.//////
         \\\\\//\    \"""\\\\\\\        |||||///|~~[[[[["\////.       \\\\\//\    ~~~~~//////      '@@@@/////\       .:;@@@@@@@..///////"
         \\\\\//\      \"""\\\\\\       \\\\\///|[[[[*\\\\\////.      \\\\\//\   ~~~~~//////        *@@@\//////\@@@@@@@@..//////////"
         \\\\\//\       \:::\\\\/      |||||///|[[[*   \\\\\\///      \\\\\//\~~~~~///////'            *@@\/////////////////////"
         \\\\\//\        \___\\/       \\\\\///|*       \\\\\/"       \\\\\//\~~////////'                 **"///////////"""
         \\\\\//\                     |||||///|                       \\\\\//\///////"
         \\\\\//\                     \\\\\///|                       \\\\\//\////"
         \\\\\///                    |||||////|                       \\\\\////"
         \\\\\/"                     \\\\\///*                        \\\\\/"
                                     """""*
*/


Compiler output:
a.cc: In function 'int32_t main()':
a.cc:37:9: error: 'revrese' was not declared in this scope
   37 |         revrese (ans.begin() , ans.end()) ;
      |         ^~~~~~~