The Incas used a sophisticated system of record keeping consisting of bundles of knotted cords.
Such a bundle of cords is called a quipu. Each individual cord represents a single number.
Surprisingly, the Incas used a base-10 positional system, just like we do today. Each digit of a number
is represented by a cluster of adjacent knots, with spaces between neighboring clusters. The digit is
determined by the number of knots in the cluster.
For example, the number 243 could be represented by a cord with knots tied in the following pattern
where each uppercase 'X' represents a knot and each '-' represents an unknotted segment of cord (all quotes for clarity only).
A sequence of numbers is represented by a sequence of cords. For example, the numbers 725, 234, and 558
could be represented by the cords
Notice how consecutive dashes are used to align clusters of knots on different cords.
Clusters representing digits in the same position
are required to overlap completely. Clusters representing digits in
different positions never overlap. All quipus obey these rules. For example, the following configurations would all be illegal:
----XXX-- [The 3 and 5 must overlap completely or not at all.]
-------XX-- [Both 2s overlap with the 9, but not each other.]
--XX----X- [The 2 and 1 cannot both overlap with the 8.]
Unlike many ancient civilizations, the Incas were aware of the concept of zero, and used it in their quipus.
A zero is represented by a cluster containing no knots. For example, the numbers 105 and 340 could be
represented by the cords
Assume that the numbers being represented do not all contain zeros in the same position. For example, any input that you could
conceivably interpret as representing the numbers 105 and 802, you should interpret as 15 and 82 instead.
Write a method to translate a sequence of quipu cords (of type String) into a sequence of integers (of type int), where the integer in position i
corresponds to the cord in position i.