Hackerrank - Prefix Compression

Problem Statement
A description of the problem can be found on Hackerrank.

Solution
Compare all characters from both string at the same index until they are not equals or we get to the end of one of strings. Equals characters are desired prefix.

I created solution in:

All solutions are also available on my GitHub.

Scala