func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<vector<int> > adj;   bool vis[100100];   int mx = 0;   int far = -1;   void dfs(int cur, int len) {     if (vis[cur]++) return;     if (len > mx) {       mx = len;       far = cur;     }     for (int x : adj[cur]) dfs(x, len + 1);   }   int main() {     int n, m;     scanf( %d%d , &n, &m);     adj = vector<vector<int> >(n);     for (int i = 0; i < m; i++) {       int x, y;       scanf( %d%d , &x, &y);       adj[x - 1].push_back(y - 1);       adj[y - 1].push_back(x - 1);     }     bool ok = (m == n - 1);     dfs(0, 0);     memset(vis, 0, sizeof(vis));     dfs(far, 0);     printf( %d , mx);     return 0;   }   