Potential Scala solution

Here is a possible Scala solution. Run it as a Scala script using `scala Goal.scala` and you should see the output:

```
gal
goal
gooal
goooal
```