You should write a program or function which receives a string representing a chessboard with only pawns as input and outputs or returns whether any capture is possible on the board.
Input is in a FEN-like notation describing positions of white and black pawns with no other pieces present. You should decide if there is a pawn which can capture an enemy one.
Each rank is described, starting with rank 8 and ending with rank 1; within each rank, the contents of each square are described from file "a" through file "h". Each pawn is identified by a single letter (white pawn = "P", black pawn = "p", ). Empty squares are noted using digits 1 through 8 (the number of empty squares), and "/" separates ranks. (partially taken from Wikipedia)
describes the board
-------- pppppppp P PPPP PPP --------
A white pawn can capture a black one if the black one is positioned diagonally up from it (black is up-left or up-right) and a black pawn can capture a white one if the white one is diagonally below from it (white is down-left or down-right). No other capture move (en passant) should be considered.
- A FEN-like string consisting of the characters
- The input describes the pawns of a valid chess game position. This means (among other more complex constraints) there will be at most 8 pawns for each side and no pawns on ranks 1 and 8.
- If there is a possible capture for either side you should output a truthy value and a falsy value otherwise.
Inputs with truthy output (one per line)
8/7p/6P1/8/8/8/8/8 8/8/p7/1P6/3P3p/8/8/8 8/2P5/8/4P1p1/2p2P2/3p4/3p1P2/8 8/P7/8/5P2/2pp4/3P2p1/3pP3/8 8/P7/p7/p1P1P3/1P3p2/8/1p6/8 8/4p1P1/2P2P1P/2p1pPpp/8/6P1/pP1p4/8
Inputs with falsy output (one per line)
8/8/8/8/8/8/8/8 8/7P/6p1/8/8/8/8/8 8/7p/7P/8/8/8/8/8 8/pppppppp/8/8/8/8/PPPPPPPP/8 8/p7/8/1p6/5P2/8/8/8 8/p7/P7/2P1p1p1/2p5/8/PP6/8
This is code golf so the shortest entry wins.