1181: Before and After Puzzle

Problem Statement