object Solution {
    
    def gcd(x: Int, y: Int): Int = {
        if (x == 0) y else gcd(y % x, x)
    }
  
    def acceptInputAndComputeGCD(pair:List[Int]) = {
        println(gcd(pair.head,pair.reverse.head))
    } 

    def main(args: Array[String]) {
         acceptInputAndComputeGCD(readLine().trim().split(" ").map(x=>x.toInt).toList)
    }
}

{'avg_line_length': 23.466666666666665, 'max_line_length': 86, 'alphanum_fraction': 0.5568181818181818, 'licenses': ['MIT'], 'repository_name': 'tobal/hackerrank', 'path': 'language-proficency/functional-programming/recursion/computing-the-gcd.scala', 'size': 352, 'lang': 'Scala'}