This page is still under construction.

Parts of this page are still being built. What you see may change.

White Squares

Interview

Time limit2sMemory limit128 MB

Summary
Given an 8x8 board marked with pieces and empty cells, count how many pieces sit on the white squares of the standard alternating coloring.
Level

Easy2 of 10

Topics
Array, Implementation, Simulation
Solved
No attempts yet

Problem

An 8×8 chessboard is colored with alternating black and white squares. The top-left square, (0, 0), is white. Given the current board, find how many pieces are on white squares.

Input

Eight lines are given, one for each row of the board. . means an empty square, and F means a square with a piece on it.

Output

Print the number of pieces on white squares.

Examples4

  1. Example 1

    Input
    .F.F...F
    F...F.F.
    ...F.F.F
    F.F...F.
    .F...F..
    F...F.F.
    .F.F.F.F
    ..FF..F.
    
    Expected output
    1
    
  2. Example 2

    Input
    ........
    ........
    ........
    ........
    ........
    ........
    ........
    ........
    
    Expected output
    0
    
  3. Example 3

    Input
    FFFFFFFF
    FFFFFFFF
    FFFFFFFF
    FFFFFFFF
    FFFFFFFF
    FFFFFFFF
    FFFFFFFF
    FFFFFFFF
    
    Expected output
    32
    
  4. Example 4

    Input
    ........
    ..F.....
    .....F..
    .....F..
    ........
    ........
    .......F
    .F......
    
    Expected output
    2