<doocs>0419.Battleships in a Board_1.py
def countBattleships( board: List[List[str]]) -> int:
    m, n = len(board), len(board[0])
    ans = 0
    for i in range(m):
        for j in range(n):
            if board[i][j] == '.':
                continue
            if i > 0 and board[i - 1][j] == 'X':
                continue
            if j > 0 and board[i][j - 1] == 'X':
                continue
            ans += 1
    return ans
def sample_funcname ( var_0 : List [ List [ str ] ] ) -> int :
    var_5 , var_7 = len ( var_0 ) , len ( var_0 [ 0 ] )
    var_8 = 0
    for var_10 in range ( var_5 ) :
        for var_11 in range ( var_7 ) :
            if var_0 [ var_10 ] [ var_11 ] == '.' :
                continue
            if var_10 > 0 and var_0 [ var_10 - 1 ] [ var_11 ] == 'X' :
                continue
            if var_11 > 0 and var_0 [ var_10 ] [ var_11 - 1 ] == 'X' :
                continue
            var_8 += 1
    return var_8
