#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[allow(unused_macros)]
macro_rules ! vec_md { ( $ init : expr ; $ ( $ dim : expr ) ;* ) => { vec_md ! ( $ ( $ dim ) ;* => $ init ) } ; ( $ head : expr ; $ ( $ tail : expr ) ;* => $ init : expr ) => { vec ! [ vec_md ! ( $ ( $ tail ) ;* => $ init ) ; $ head ] } ; ( $ head : expr => $ init : expr ) => { vec ! [ $ init ; $ head ] } ; }

#[allow(unused_macros)]
macro_rules! chmax {
    ( $ x : expr , $ y : expr ) => {
        if $ x < $ y {
            $ x = $ y;
            true
        } else {
            false
        }
    };
}

fn main() {
    input! {
        h: usize, w: usize,
        s: [chars; h]
    }

    let mut left = vec_md![0u64;h;w];
    let mut right = vec_md![0u64;h;w];
    let mut up = vec_md![0u64;h;w];
    let mut down = vec_md![0u64;h;w];

    for y in 0..h {
        let mut left_cnt = 0;
        let mut right_cnt = 0;
        for x in 0..w {
            let bx = w-1-x;
            if s[y][x] == '#' {
                left_cnt = 0;
            } else {
                left[y][x] = left_cnt;
                left_cnt += 1;
            }

            if s[y][bx] == '#' {
                right_cnt = 0;
            } else {
                right[y][bx] = right_cnt;
                right_cnt += 1;
            }
        }
    }

    for x in 0..w {
        let mut up_cnt = 0;
        let mut down_cnt = 0;
        for y in 0..h {
            let by = h-1-y;
            if s[y][x] == '#' {
                up_cnt = 0;
            } else {
                up[y][x] = up_cnt;
                up_cnt += 1;
            }

            if s[by][x] == '#' {
                down_cnt = 0;
            } else {
                down[by][x] = down_cnt;
                down_cnt += 1;
            }
        }
    }

    let mut ret = 0;
    for y in 0..h {
        for x in 0..w {
            chmax!(ret, left[y][x] + right[y][x] + up[y][x] + down[y][x] + 1);
        }
    }
    println!("{}", ret);
}

Measured memory_bytes: 184572