My dog Smokey used to have the same reaction (the foaming thing)
when he was a pup. The older he got and the more walks he went on, it
lessened & finally stopped altogether.I think his nose was just overloaded
by the scent of other dogs smells they he discovered along the way.