Once thought to be insulated from the retail industry's challenges, the dollar stores, which got the name because they try to price items for $1 or less, such as Dollar General Corp, Dollar Tree Inc and Big Lots Inc derive much of their sales from household staples.

But investors have been drawn to two growing mid-sized chains, Ollie's Bargain Outlet Holdings Inc and Five Below Inc, which have carved out distinct niches within the discount space focusing on discretionary items, analysts said.

Appealing to trend-watchers and bargain hunters has helped Ollie's and Five Below stand out while other discounters face intensifying competition from new entrants such as German chains Aldi and Lidl, analysts and investors said.

Ollie's sells brand-name overstock items from air conditioners to hair dye, and Five Below caters to teens.

"They're differentiated concepts," said Anthony Chukumba, managing director at Loop Capital in Chicago of Ollie's and Five Below. "That's one of the reasons they're outperforming."

Also, investors said, the strong U.S. economy and the federal tax overhaul have given discount shoppers customers more disposable income. As a result, some have shifted their spending to big-box retailers such as Walmart Inc and Target Corp.

Dollar Tree stock has fallen 24.1 percent this year, while shares of Big Lots have plunged 26.6 percent. Shares of Dollar General have risen 1.5 percent but still lag the S&P Composite 1500 Multiline Retail index <.SPCOMMULR>, which includes discount retailers and department stores and has advanced 9.0 percent in the same period.

Ollie's, whose stores are located mainly on the U.S. East Coast, sells closeout and overstock merchandise at deeply discounted prices. The company's shares have climbed 41.0 percent this year. Ollie's shares were little changed on Wednesday after late Tuesday's first-quarter results beat analyst estimates, while the company raised its sales and profit guidance for the 2018 fiscal year.

Gary Bradshaw, a portfolio manager at Hodges Capital Management in Dallas, was persuaded to buy Ollie's shares after coming across the store on a visit to Pennsylvania last year. He compared his trip to Ollie's to a treasure hunt.

"That was the neatest store," he said. "I came back and bought the stock, and ever since, it's gone up and up and up."

Five Below Inc, which has locations in 32 U.S. states and caters to pre-teen and teenage consumers with items below $5, has had its shares rise 22.6 percent year to date. The chain has found success capitalizing on teen-centered trends such as slime-making kits and mermaid-themed items, Chukumba said. Five Below is scheduled to report its first-quarter results after the market close on Wednesday.

Last week, shares of all three big dollar discount stores fell after the retailers' quarterly results missed analyst expectations. Dollar Tree and Dollar General attributed their lower-than-expected same-store sales to unusually cold spring weather.

To be sure, they haven't completely lost favor. Loop Capital has a "buy" rating for Dollar Tree, and Hodges owns both Dollar Tree and Dollar General shares. Even some investors who are less bullish on the discount segment say the dip in share prices may make them attractive buys.

"With the pullback in the stocks, they're getting close to fair value," said Arun Daniel, senior portfolio manager at JO Hambro Capital Management in Boston.

Dollar General and Dollar Tree each have some 15,000 stores throughout most of the United States. Five Below and Ollie's combined have only about 1,000 stores. In Ollie's earnings call on Tuesday, chief executive Mark Butler said the company, which currently has fewer than 300 stores, sees potential to expand to more than 950 locations.

"It's a classic growth story," Bradshaw said, in reference to Ollie's. "Everybody loves to find a deal."

(Reporting by April Joyner; Editing by Alden Bentley and Cynthia Osterman)

By April Joyner