IMO training problem
Given a positive integer \(n\), let \(p(n)\) be the product of the non-zero digits of \(n\). (If \(n\) has one digit, then \(p(n)\) is equal to that digit.) Let
\[S = p(1) + p(2) + \cdots + p(999). \]
What is the largest prime factor of \(S\)?