This page is still under construction.

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

Misha and the Negative

Interview

Time limit2sMemory limit512 MB

Summary
Given two binary black-and-white images of the same size, count the pixels where the second image does not equal the negative of the first.
Level

Easy2 of 10

Topics
Implementation, Array, String, Simulation
Solved
No attempts yet

Problem

Misha has already learned to take good photographs and recently became interested in programming. The first program he wrote produces the negative of a binary black-and-white image.

A binary black-and-white image is a rectangle made of pixels, each of which is either black or white. The negative of such an image is obtained by replacing every black pixel with white and every white pixel with black.

As a beginning programmer, Misha wrote his program with a mistake, so running it could produce an incorrect negative. To estimate how far the resulting negative deviates from the image, Misha began testing his program.

He used the original images as input data. He then carefully analyzed the negatives produced by the program, each time counting the pixels of the negative that were produced incorrectly.

The task is to write a program that takes a binary black-and-white image and the negative produced by Misha's program as input, and from them determines the number of pixels where a mistake was made.

Input

The first line of the input file contains the integers n and m (1 ≤ n, m ≤ 100), the height and width of the original image in pixels.

The next n lines describe the original image. Each line consists of m characters, «B» and «W». The character «B» corresponds to a black pixel and «W» to a white pixel.

Then comes an empty line, followed by a description of the image produced by Misha's program, in the same format as the original image.

Output

The output file must contain the number of pixels of the negative that Misha's program formed incorrectly.

Examples2

  1. Example 1

    Input
    3 4
    WBBW
    BBBB
    WBBW
    
    BWWW
    WWWB
    BWWB
    
    Expected output
    2
    
  2. Example 2

    Input
    2 2
    BW
    BB
    
    WW
    BW
    
    Expected output
    2