Chess Beginner Bushil
Time limit1sMemory limit1024 MB
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 , , , , , and 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 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 squareKork: kingPorp: pawnNorn: knightBorb: bishopRorr: rookQorq: queen
Output
Print the piece score of the given chess board.