On a chessboard, positions are marked with a letter between a and h for the column, and a number between 1 and 8 for the row. Given two position strings (e.g. "a1", "b8"), return true if they have the two spaces are the same color. The first place on the board, a1, is black. The next is white, alternating across a row. Odd rows start with black, even rows start with white.

Complete the following file:


#include <iostream> #include <string> using namespace std; bool areSameColor(string space1, string space2) { string col1 = space1.substr(0, 1); string row1 = space1.substr(1, 1); string col2 = space2.substr(0, 1); string row2 = space2.substr(1, 1); bool row1Even = row1 == "0" || row1 == "2" || row1 == "4" || row1 == "6";