Problem 3798 · Easy
Keep the longest prefix that ends at the last digit 2, because only a final 2 makes the number even.
Open the interactive visualisation