Hershey (NYSE:HSY) has been a long-term winner for investors, but there have also been difficult stretches. These stretches lasted for several years on some occasions, and this can lead to investor frustration. While a similar trend is possible in the near future, it's not likely.

Prior to Hershey teaming up with The Cambridge Group, a division of Nielsen, the company's product innovations weren't meeting expectations. Then, when Mars and Wrigley merged in 2008, Hershey knew the competition would increase. To make matters worse, Kraft (UNKNOWN:KRFT.DL) acquired Cadbury in 2010. Kraft then spun off Kraft Foods and changed its name to Mondelez International (NASDAQ:MDLZ), which is now one of Hershey's top rivals. Both companies are performing well, but one has been outperforming the other lately.

Let's take a look at what Hershey has done to improve its operations, and if its underlying business looks more impressive than that of Mondelez International at the moment.

Altered strategy
Before teaming up with The Cambridge Group, Nielsen says, Hershey would innovate relentlessly and then push the products it came up with onto retailers. For instance, Hershey offered a wide variety of Hershey's Kisses which had different fillings and packaging. It was a supply-chain-focused operation. There were no big hits from the company's product innovations, which led to increased inventory and higher supply chain costs. That strategy has changed significantly over the past few years, and it has worked.

Hershey's strategy change focused on consumer insights and targeting the most profitable consumers. Instead of Hershey choosing product innovations, the consumers would choose them without even realizing it. Consumer insights also began to drive marketing campaigns. Everything became centered around the consumer and the highest-demand opportunities.

According to Nielsen, Hershey's consumer insights are based on taste preferences, motivations, needs, and retailer shopping choices. Hershey also uses the "Who, What, Where, When, How" philosophy. Hershey found the most profitable consumer to be the one that likes to try new varieties of Hershey candies, which the company humorously dubbed "Engaged Exploring Munchers."

You might think this would lead to increased supply chain costs, as Hershey would have to pump out one product innovation after another, but that's not the case. Hershey has shied away from its underperforming brands and focused more on the most profitable brands and innovations while expanding its core brands, such as Hershey's, Reese's, Kit Kat, Twizzlers, and Ice Breakers. Hershey is now focusing on fewer products, but they're also more profitable products.

However, does all this mean that Hershey has had a stronger underlying operation than Mondelez International recently? If you're thinking of investing in the sweet-tooth consumer, then you're going to want best-of-breed.

Hershey vs. Mondelez International
Mondelez International is a larger company than Hershey, with a market cap of $61.80 billion versus Hershey's market cap of "just" $21.69 billion. However, bigger doesn't always mean better. Don't get the wrong idea, Mondelez has significant growth opportunities, but if you look at key trends for these two companies over the past year you will see that Hershey is a clear winner on both the top and bottom lines:

HSY Net Income (TTM) Chart

HSY Net Income (TTM) data by YCharts.

Furthermore, Hershey currently yields a 2% dividend, whereas Mondelez yields 1.60%. That said, thanks to its size, Mondelez has generated more operating cash flow over the past year, to the tune of $2.95 billion versus $1.11 billion for Hershey. Still, I'd rather go with the company showing stronger growth on both the top and bottom lines that also generates strong cash flow relative to its capitalization. 

The other bottom line
Hershey has figured out that we're now living in a demand-driven consumer environment. If a company doesn't offer consumers what they want and need, then the company will fail. Fortunately, Hershey is meeting consumer demands, and it's growing its top and bottom lines in a challenging consumer environment. To me, that's the sign of a winner.