func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1010;   char mtr[MAXN][MAXN];   int main() {     int n, m;     cin >> n >> m;     set<int> s;     bool ok = true;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         cin >> mtr[i][j];       }     }     for (int i = 1; i <= n; i++) {       int gnomo, doce;       for (int j = 1; j <= m; j++) {         if (mtr[i][j] ==  G ) gnomo = j;         if (mtr[i][j] ==  S ) doce = j;       }       int r = doce - gnomo;       if (r > 0)         s.insert(r);       else         ok = false;     }     if (ok == false) {       cout <<  -1  << endl;       return 0;     }     cout << s.size() << endl;   }   