Does this program have a runtime of O(N) or O(n*m)
Big $O$ is merely a function that describes an upper bound of another function, so it can be used in different ways.  You can describe the big $O$ of the memory usage of a function, or the big $O$ of the number of operations a function performs.

What you've encountered is simply that, by using different descriptors of the inputs, you wind up with different descriptors of the function itself.  The function you have described is, in fact, linear to the total number of characters in the input.  That statement is not wrong, but $O(nm)$, where $m$ is the average number of characters of the words in a set, is clearly a more useful description of the behavior of the function.