Many programmers use CamelCase
when naming variables, functions, classes and other entities. In CamelCase, when a name consists of multiple words concatenated together, such as myawesomevariablename
, the first letter of every distinct word is capitalized. Sometimes there is more than one way to turn a string of letters into CamelCase.
Lower | Upper | |
---|---|---|
CamelCase |
myAwesomeVariableName |
MyAwesomeVariableName |
In Lower CamelCase the first word is the only word not capitalized, whereas in Upper CamelCase all of the words are capitalized.
The input will contain a dictionary, followed by test cases.
The dictionary starts with an integer where followed by lines, each containing a word.
A word consists of a string of lowercase English letters and the apostrophe character '
(ASCII ).
Each of the lines following the dictionary will contain a single test case. Each test case consists of a string of lowercase English letters of length or less, created by concatenating words from the dictionary.
Your program should output integers (one per line), representing the minimum number of capitalizations required to convert each test word to Lower CamelCase
, so that it can be read as a string of legal words from the dictionary.
Note that the sample input below contains only test cases, but the real data files will contain .
Sample Input
26
aid
all
app
apple
brown
come
country
crab
crabapple
dogs
for
fox
good
is
jumps
lazy
men
now
of
orchard
over
quick
the
their
time
to
apple
appleorchard
crabapple
thequickbrownfoxjumpsoverthelazydogs
Sample Output
0
1
0
8
Educational Computing Organization of Ontario - statements, test data and other materials can be found at ecoocs.org
Comments
ACs
I'm just wondering, but when ECOO questions are graded, is there a difference between receiving a row of checkmarks or a row of O's for each test case?
They both mean the same thing.
With the influx of recent submissions, it figures the judge should grade this problem in a manner more reflective of judges during the actual ECOO competition. All submissions have been rejudged.
Additional feedback for individual cases can be found on the submission page.
What does the line of Os mean on the AC submissions?
That sweet moment when the fastest submission is in Python (I'm counting the days that this lasts) (2017/03/15 - 2017/03/16) (RIP) Back on top baby (2017/04/10-2017/05/01)rip rejudging