Under construction

Still being built. Things may change

Chess Beginner Bushil

Time limit1sMemory limit1024 MB

Summary
Given an 8x8 chess board, compute White's piece score minus Black's piece score using the standard point values for each piece.
Level

Easy1 of 10

Topics
Implementation
Solved
No attempts yet

Problem

Bushil has just started learning chess and is still a beginner, so he is not good at calculating piece scores on the board.

The piece score of a board is the sum of White's piece scores minus the sum of Black's piece scores. The scores of king, pawn, knight, bishop, rook, and queen are 00, 11, 33, 33, 55, and 99 points, respectively.

Help the beginner Bushil by computing the piece score of a chess board.

Input

The next 8 lines give the state of an 8×88\times8 chess board with no spaces. White pieces are uppercase letters and Black pieces are lowercase letters.

The input consists only of ., K, k, P, p, N, n, B, b, R, r, Q, and q. Each character means:

  • .: empty square
  • K or k: king
  • P or p: pawn
  • N or n: knight
  • B or b: bishop
  • R or r: rook
  • Q or q: queen

Output

Print the piece score of the given chess board.

Examples3

  1. Example 1

    Input
    rnbqkbnk
    pppppppp
    ........
    ........
    ........
    ........
    PPPPPPPP
    RNBQKBNK
    
    Expected output
    0
    
  2. Example 2

    Input
    RRRRRRRR
    RRRRRRRR
    RRRRRRRR
    RRRRRRRR
    rrrrrrrr
    rrrrrrrr
    rrrrrrrr
    rrrrrrrk
    
    Expected output
    5
    
  3. Example 3

    Input
    rrrrrrrr
    rrrrrrrr
    rrrrrrrr
    rrrrrrrr
    rrrrrrrr
    rrrrrrrr
    rrrrrrrr
    rrrrrrrr
    
    Expected output
    -320