Matrices of words P52233


Statement
 

pdf   zip   main.cc

html

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.

Information
Author
Salvador Roura
Language
English
Translator
Carlos Molina
Original language
Catalan
Other languages
Catalan
Official solutions
C++
User solutions
C++