A higher resolution is required to access the IDE
- 1
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
Determine which candidate strings (if any) match the given template string according to the stated rules.The following rules must be applied in order to match:
letterCase
letterFuzz
The alphabetical distance a letter character in candidate is permitted to stray from its counterpart in template. If letterFuzz=0, the letters must match precisely.
For example, if letterFuzz=1,
Note: Fuzziness does not wrap around the ends of the alphabet - if letterFuzz=3,
numberFuzz
The maximum permitted difference between an integer value - not the individual digits - in candidate and its counterpart in template.
If numberFuzz=1,
Numbers are never negative, and never have leading zeroes or decimal places.
otherFuzz
For example,
Example:
false
2
1
false
Apple10,Orange9
1
apple9?pramed7
Output:
false
Input
Line 1: string letterCase
Line 2: integer letterFuzz
Line 3: integer numberFuzz
Line 4: string otherFuzz
Line 5: string template, the string to compare other strings against
Line 6: integer n, the number of strings to compare to template
Next n lines: string candidate
Line 2: integer letterFuzz
Line 3: integer numberFuzz
Line 4: string otherFuzz
Line 5: string template, the string to compare other strings against
Line 6: integer n, the number of strings to compare to template
Next n lines: string candidate
Output
n lines: true (if template matches candidate according to the rules), or false
Constraints
letterCase = true or false
0 <= letterFuzz <= 25
0 <= numberFuzz <= 100
otherFuzz =true or false
1 <= n <= 20
1 <= length of template, length of candidate <= 100
0 <= (any number value in template or candidate) < 2^31
0 <= letterFuzz <= 25
0 <= numberFuzz <= 100
otherFuzz =
1 <= n <= 20
1 <= length of template, length of candidate <= 100
0 <= (any number value in template or candidate) < 2^31
Example
Input
true 0 0 true Some1thing? 6 some1thing? Some1thing? Some1thing! Some thing? Some2thing? Some1thang?
Output
false true false false false false
A higher resolution is required to access the IDE