func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MAXN = 1e5 + 10;   int n, m;   vector<int> g[MAXN];   int max1[MAXN], max2[MAXN];   bool vis[MAXN];   void dfs(int v) {     vis[v] = true;     for (auto to : g[v]) {       if (!vis[to]) {         dfs(to);         if (max1[v] <= max1[to] + 1) {           max2[v] = max1[v];           max1[v] = max1[to] + 1;         } else if (max2[v] < max1[to] + 1) {           max2[v] = max1[to] + 1;         }       }     }   }   int ans;   int main() {     cin >> n >> m;     while (m--) {       int u, v;       cin >> u >> v;       g[u].push_back(v);       g[v].push_back(u);     }     for (int i = 1; i <= n; i++)       if (!vis[i]) dfs(i);     for (int i = 1; i <= n; i++) ans = max(ans, max1[i] + max2[i]);     cout << ans;     return 0;   }   