Lake Counting 2386

const N: i32 = 10;
const M: i32 = 12;

fn dfs(x: i32, y: i32) {
   field[x][y] = ".".to_string();

   for (let dx in -1..1) {
      for (let dy in -1..1) {
         let nx = x + dx;
         let ny = y + dy;

         if(0 <= nx && nx < N && 0 <= ny && ny < M && field[nx][ny] == 'W') {
            dfs(nx, ny);
         }
      }
   }
}


fn main() {
   let field[N, M];
   let mut res = 0;
   for i in 0..N {
      for j in 0..M {
         if field[i][j] == 'W' {
            dfs(i, j);
            res =+ 1;
         }
      }
   }
   println!("{}", res);
}