Traffic light dash!

Write a function that can answer the questions at the bottom of the page by parsing this string:

There are 9 traffic lights on my way to work. On my way in 3 were red, 2 were green.

Make sure this function work for other journeys too, like:

There are 12 traffic lights on my way home (I take a different route). On the way 2 were orange, and 8 were green.