Language: C++

#include<iostream>

using namespace std;

int main(){
    int n,l;
    cin >> n >> l;
    char s[n][l];
    int t[n][l];
    for(int i = 0;i < n;i++){
        cin >> s[i];
        for(int j = 0;j < l;j++){
            if(s[i][j] == 'a'){
                t[i][j] = 1;
            }
            if(s[i][j] == 'b'){
                t[i][j] = 2;
            }
            if(s[i][j] == 'c'){
                t[i][j] = 3;
            }
            if(s[i][j] == 'd'){
                t[i][j] = 4;
            }
            if(s[i][j] == 'e'){
                t[i][j] = 5;
            }
            if(s[i][j] == 'f'){
                t[i][j] = 6;
            }
            if(s[i][j] == 'g'){
                t[i][j] = 7;
            }
            if(s[i][j] == 'h'){
                t[i][j] = 8;
            }
            if(s[i][j] == 'i'){
                t[i][j] = 9;
            }
            if(s[i][j] == 'j'){
                t[i][j] = 10;
            }
            if(s[i][j] == 'k'){
                t[i][j] = 11;
            }
            if(s[i][j] == 'l'){
                t[i][j] = 12;
            }
            if(s[i][j] == 'm'){
                t[i][j] = 13;
            }
            if(s[i][j] == 'n'){
                t[i][j] = 14;
            }
            if(s[i][j] == 'o'){
                t[i][j] = 15;
            }
            if(s[i][j] == 'p'){
                t[i][j] = 16;
            }
            if(s[i][j] == 'q'){
                t[i][j] = 17;
            }
            if(s[i][j] == 'r'){
                t[i][j] = 18;
            }
            if(s[i][j] == 's'){
                t[i][j] = 19;
            }
            if(s[i][j] == 't'){
                t[i][j] = 20;
            }
            if(s[i][j] == 'u'){
                t[i][j] = 21;
            }
            if(s[i][j] == 'v'){
                t[i][j] = 22;
            }
            if(s[i][j] == 'w'){
                t[i][j] = 23;
            }
            if(s[i][j] == 'x'){
                t[i][j] = 24;
            }
            if(s[i][j] == 'y'){
                t[i][j] = 25;
            }
            if(s[i][j] == 'z'){
                t[i][j] = 26;
            }
        }
    }
    for(int i = 0;i < l;i++){
        for(int j = 1;j < n;j++){
            if(i == 0 || t[j-1][i-1] == t[j][i-1] || (t[j][i-1] == t[j+1][i-1] && j < n-1)){
                for(int k = 0;k < n;k++){
                    int x = 0;
                    if(t[x][i] < t[j][i]){
                        x = j;
                    }
                    for(int m = 0;m < l;m++){
                        char ss[l];
                        ss[m] = s[x][m];
                        s[x][m] = s[n-k-1][m];
                        s[n-k-1][m] = ss[m];
                        int tt;
                        t = t[x][m];
                        t[x][m] = t[n-k-1][m];
                        t[n-k-1][m] = t[x][m]
                    }
                }
            }
        }
    }
    for(int i = 0;i < n;i++){
        for(int j = 0;j < l;j++){
            cout << s[i][j];
        }
    }
    cout << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:107:27: error: incompatible types in assignment of 'int' to 'int [n][l]'
  107 |                         t = t[x][m];
      |                         ~~^~~~~~~~~
a.cc:109:46: error: expected ';' before '}' token
  109 |                         t[n-k-1][m] = t[x][m]
      |                                              ^
      |                                              ;
  110 |                     }
      |                     ~