#include "validation.h" const int maxN = 5'000; // number of strings const int maxW = 5'000; // width const int maxL = 1'000'000; // total text size int main(int argc, char **argv) { InputValidator v(argc, argv); int n = v.read_integer("n", 1, maxN); v.space(); int w = v.read_integer("w", 1, maxW); v.newline(); std::string alphabet(26, ' '); std::iota(std::begin(alphabet), std::end(alphabet), 'a'); std::vector words = v.read_strings("words", n, 1, maxW, alphabet, StrictlyIncreasing, Newline); long long L = 0; for (std::string s: words) L += s.size(); v.check(L <= maxL, "total number of characters is too large!"); }