added p1 scala solution