Matrices of words

Using the declarations

        typedef vector<string> Row;
        typedef vector<Row> Matrix;

write a function

        int number_of_words(const Matrix& m, char c, int k);

that returns how many words @w@ of the Matrix @m@ have the character @c@
at the position @k@, that is, fulfil @p[k]@ = @c@ (when @p[k]@ exists).
Take into account that the “matrix” @m@ is not necessary rectangular,
i.e., some rows may be larger than others.

Precondition

@k@  ≥ 0

Observation

You only need to submit the required procedure; your main program will
be ignored.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:09:44.455Z

© Jutge.org, 2006–2026.
https://jutge.org
