added scala p2 scala solution