<gouthampradhan>array_BattleshipsInABoard_1.java
public int countBattleships(char[][] board) {
    int count = 0;
    for (int i = 0; i < board.length; i++) {
      for (int j = 0; j < board[0].length; j++) {
        if (board[i][j] == 'X') {
          if (i - 1 >= 0) { 
            if (board[i - 1][j] == 'X') continue;
          }
          if (j - 1 >= 0) {
            if (board[i][j - 1] == 'X') {
              continue;
            }
          }
          count++;
        }
      }
    }
    return count;
  }
public int sample_funcname ( char [ ] [ ] var_0 ) {
  int var_2 = 0 ;
  for ( int var_3 = 0 ;
  var_3 < var_0 . length ;
  var_3 ++ ) {
    for ( int var_5 = 0 ;
    var_5 < var_0 [ 0 ] . length ;
    var_5 ++ ) {
      if ( var_0 [ var_3 ] [ var_5 ] == 'X' ) {
        if ( var_3 - 1 >= 0 ) {
          if ( var_0 [ var_3 - 1 ] [ var_5 ] == 'X' ) continue ;
        }
        if ( var_5 - 1 >= 0 ) {
          if ( var_0 [ var_3 ] [ var_5 - 1 ] == 'X' ) {
            continue ;
          }
        }
        var_2 ++ ;
      }
    }
  }
  return var_2 ;
}
