func_code_string: #include <bits/stdc++.h>   using namespace std;   struct point {     int i;     int j;   };   int main() {     vector<char> s;     int n, m;     char c;     char a[102][102];     point first;     first.i = -1;     point last;     memset(a, 0, sizeof(a));     scanf( %d %d %c , &n, &m, &c);     getchar();     for (int i = 0; i < n + 1; i++) {       a[i][0] = c;       a[i][m + 1] = c;     }     for (int i = 0; i < m + 1; i++) {       a[0][i] = c;       a[n + 1][i] = c;     }     for (int i = 1; i < n + 1; i++) {       for (int j = 1; j < m + 1; j++) {         scanf( %c , &c);         a[i][j] = c;         if (c == a[0][0]) {           if (first.i < 0) {             first.i = i;             first.j = j;           }           last.i = i;           last.j = j;         }       }       getchar();     }     int can;     for (int i = first.i; i < last.i + 1; i++) {       for (int j = first.j; j < last.j + 1; j++) {         can = count(s.begin(), s.end(), a[i][j]);         if (a[i - 1][j] !=  .  && count(s.begin(), s.end(), a[i - 1][j]) == 0)           s.push_back(a[i - 1][j]);         if (a[i][j - 1] !=  .  && count(s.begin(), s.end(), a[i][j - 1]) == 0)           s.push_back(a[i][j - 1]);         if (a[i][j + 1] !=  .  && count(s.begin(), s.end(), a[i][j + 1]) == 0)           s.push_back(a[i][j + 1]);         if (a[i + 1][j] !=  .  && count(s.begin(), s.end(), a[i + 1][j]) == 0)           s.push_back(a[i + 1][j]);       }     }     if (s.size())       printf( %d n , s.size() - 1);     else       printf( %d n , s.size());     return 0;   }   