def getPatternsWrap(input:str, N:int):
    """
    Returns a dict of patterns (key, value), where key is a found pattern and value is number of pattern appearing in input.
    
    Does count patterns that wrap (example: 'ADAM' N=3, will find pattern MAD).
    """
    patterns = dict()
    i = N
    #If we want all patterns at most N len:
    #for i in range(2,N+1):
    wrapinput = input[len(input)-i+1:len(input)] + input 
    chunks = [wrapinput[j:j+i] for j in range(0, len(wrapinput))]
    for k in chunks:
        if len(k)==i:
            patterns.setdefault(k,0)
            patterns[k]+=1
    return patterns