05AB1E , 5 bytes
ŒIù.M
Try it online or verify the smaller test cases or verify the larger test case (which is a bit slow).
Explanation:
Œ # Push all substrings of the (implicit) input-string
Iù # Only keep substrings of a length equal to the second input-integer
.M # Only keep the most frequent item of the remaining substrings
# (after which it is output implicitly as result)
ŒIù.M
Try it online or verify the smaller test cases or verify the larger test case (which is a bit slow).
Explanation:
Œ # Push all substrings of the (implicit) input-string
Iù # Only keep substrings of a length equal to the second input-integer
.M # Only keep the most frequent item of the remaining substrings
# (after which it is output implicitly as result)
05AB1E , 5 bytes
ŒIù.M
Try it online or verify the smaller test cases or verify the larger test case (which is a bit slow).
Explanation:
Œ # Push all substrings of the (implicit) input-string
Iù # Only keep substrings of a length equal to the second input-integer
.M # Only keep the most frequent item of the remaining substrings
# (after which it is output implicitly as result)
ŒIù.M
Try it online. or verify the smaller test cases or verify the larger test case (which is a bit slow).
Explanation:
Œ # Push all substrings of the (implicit) input-string
Iù # Only keep substrings of a length equal to the second input-integer
.M # Only keep the most frequent item of the remaining substrings
# (after which it is output implicitly as result)
ŒIù.M
Try it online or verify the smaller test cases or verify the larger test case (which is a bit slow).
Explanation:
Œ # Push all substrings of the (implicit) input-string
Iù # Only keep substrings of a length equal to the second input-integer
.M # Only keep the most frequent item of the remaining substrings
# (after which it is output implicitly as result)