In the following 6 digit number:

```
283910
```

`91` is the greatest sequence of 2 consecutive digits.

In the following 10 digit number:
```
1234567890
```

`67890` is the greatest sequence of 5 consecutive digits.

Complete the solution so that it returns the greatest sequence of five consecutive digits found within the number given. The number will be passed in as a string of only digits. It should return a five digit integer. The number passed may be as large as 1000 digits. 

*Adapted from ProjectEuler.net*

Difficulty: introductory

Starter code:

def solution(digits):
	

Solutions:
def solution(digits):
    numlist = [int(digits[i:i+5]) for i in range(0,len(digits)-4)]
    return max(numlist)

def solution(digits):
    return int(max(digits[a:a + 5] for a in range(len(digits) - 4)))

def solution(digits):
    result = -1;
    for i in range(len(digits)):
        current = int(digits[i: i+5])
        if current >= result:
            result = current
    return result

def solution(digits):
    maxNum = 0
    for i in range(len(digits)-4):
        curNum = int(digits[i:i+5])
        if curNum > maxNum:
            maxNum = curNum
    return maxNum

def solution(digits):
    cc = []
    for i in range(len(digits)):
        cc.append(digits[i:i+5])
    return int(max(cc))

def solution(digits):
    mx = 0
    for i in range(len(digits) - 4):
        n = int(digits[i:i + 5])
        if n > mx:
            mx = n
    return mx

def solution(digits):
    return int(max(''.join(digits[n:n + 5]) for n in range(len(digits) - 4)))


def solution(digits):
    final = 0
    stg = str(digits)
    for (num1, num2) in enumerate(stg):
        try:
            if int(str(stg[num1]) + str(stg[num1+1])) > final:
                final = int(str(stg[num1]) + str(stg[num1+1]))
            if int(str(stg[num1]) + str(stg[num1 + 1]) + str(stg[num1 + 2])) > final:
                    final = int(str(stg[num1]) + str(stg[num1 + 1]) + str(stg[num1 + 2]))
            if int(str(stg[num1]) + str(stg[num1 + 1]) + str(stg[num1 + 2]) + str(stg[num1 + 3])) > final:
                    final = int(str(stg[num1]) + str(stg[num1 + 1]) + str(stg[num1 + 2]) + str(stg[num1 + 3]))
            if int(str(stg[num1]) + str(stg[num1 + 1]) + str(stg[num1 + 2]) + str(stg[num1 + 3]) + str(stg[num1 + 4])) > final:
                    final = int(str(stg[num1]) + str(stg[num1 + 1]) + str(stg[num1 + 2]) + str(stg[num1 + 3]) + str(stg[num1 + 4]))
  
        except:
            pass
    return final

from itertools import islice
def solution(digits):
    return int(max(map(''.join, zip(*(islice(digits, a, None) for a in range(5))))))

def solution(d):
    return int(max([d[j:j+5]] for j in [i for i in range(len(d)) if d[i]==max(d)])[0])


def solution(digits):
    result = -1
    for i in range(len(digits)):  # for each digit in the range of the digits (= without starting over, it will start and only go untill the last number, then no more checks)
        # new number, starting one plus up to 4 next (index and untill index+5)
        current = int(digits[i: i+5])
        # if new number is higher than a previous check, it's a new result (check starts as -1, so every FIRST check is the new result)
        if current >= result:
            result = current  # it will loop untill the next check isn't higher; then it finishes and returns the result
    return result

def solution(digits):
    a = []
    for i in range(len(digits)-4):
        a.append(give5LengthNumber(digits[i:]))
    return(int(max(a)))
    
def give5LengthNumber(num):
    return num[0:5]

def solution(digits):
    mnum = 0
    for i in range(5,len(digits)):
        for j in range(i, len(digits)+1):
            if int(digits[j-5:j])>mnum:
                mnum = int(digits[j-5:j])
    return mnum


def solution(digits):
    largest = 0
    for i in range(len(digits)-4):
        a = int(digits[i:i+5])
        if (a > largest):
            largest = a
    return largest;

def solution(digits):
    return max(int(digits[i - 5: i]) for i, _ in enumerate(digits, 5))

def solution(d):
    for x in '9876543210':
        for y in '9876543210':
            for z in '9876543210':
                for w in '9876543210':
                    for q in '9876543210':
                        if d.find(x + y + z + w + q) != -1:
                            return int(x + y + z + w + q)

def solution(x):
    v = 99999
    while v > 0:
        if str(v) in str(x):
            return v
        v = v - 1

def solution(digits):
    max = 99999
    while True:
        if str(max) in digits:
            return max
        else:
            max -= 1
        
    return 0;

def solution(digits):
    ans = []
    for i in range(0, len(digits)-4):
        ans.append(int(digits[i:i+5]))
    return max(ans)


def solution(s):
    result = [i for i in s]
    new = []
    for i in range(0,len(result),1):
        new.append(result[i:i+5])

    Lnumber = int(''.join(map(str,max(new))))
    return Lnumber




def solution(digits):
    maxdi = 0
    for i in range(len(digits)-4):
        each5 = int(digits[i:i+5])
        if each5 > maxdi:
            maxdi = each5
    return maxdi

def solution(digits):
    number_string = str(digits)
    
    sequence_list = []
    
    for i in range(len(number_string) - 4):
        
        five_sequence = number_string[i:i+5]
        
        if int(five_sequence) > int(number_string[i+1:i+6]):
            sequence_list.append(int(five_sequence))
            
    return max(sequence_list)


def solution(digits):
    maxi = 0
    for i in range(len(digits) - 4):
        if int(digits[i:i+5]) > maxi:
            maxi = int(digits[i:i+5])
    return maxi

def solution(digits):
    result = digits[:6]
    for i in range(len(digits)):
        s = digits[i:i+5]
        if len(s) < 5:
            break
        if result < s:
            result = s
    return int(result);

def solution(digits):
    n = len(digits)
    max = 0
    for i in range(n - 4):
        if(max < int(str(digits[i:i+5:]))):
            max = int(str(digits[i:i+5:]))
    return max

def solution(digits):
    x = str(digits)
    empty = []
    for i in range(0,len(x)):
        empty.append(int(x[i:i+5]))
        
    return max(empty)

def solution(digits):
    biggest = 0
    five = ""
    for loop in range(len(digits)-4):
        five = (digits[loop]+digits[loop+1]+digits[loop+2]+digits[loop+3]+digits[loop+4]);
        if biggest<int(five):
            biggest = int(five);
    return biggest;


def solution(digits):
    return max([int(digits[item:item+5]) for item in range(len(digits)-4)])

def solution(digits):
    i = 0 
    j = 5 
    largest = 0
    while j <= len(digits):
        relative = int(digits[i:j])
        if relative > largest:
            largest = relative 
        i += 1
        j += 1
    return largest


def solution(digits):
    number = 0
    digits = str(digits)
    for i in range(len(digits)):
        slice = digits[i:i + 5]
        if  int(slice) > number: number = int(slice) 
    return number


def solution(digits):       
    k = []
    for i in range(len(digits)): k.append(int(digits[i:i+5]))
    return max(k)

def solution(digits):       
    i, k = 0, []
    while i<len(digits):
        k.append(int(digits[i:i+5]))
        i += 1
    return max(k)

def solution(digits):
    digits = str(digits)        
    i, k = 0, []
    while i<len(digits):
        k.append(int(digits[i:i+5]))
        i += 1
    return max(k)

def n(digits):
    digits = str(digits)
    k = []
    i = 0
    while i<len(digits):
        k += [int(digits[i:i+5])]
        i += 1
    return k
            

solution = lambda digits: max(n(digits))

def n(digits):
    digits = str(digits)
    k = []
    i = 0
    while i<len(digits):
        k += [int(digits[i:i+5])]
        i += 1
    return k
            

def solution(digits):
    return max(n(digits))

def solution(digits):    
    n=0
    e=len(digits)-1
    for x in range(0,len(digits)-1):
        if int(digits[x:x+5])>n:n=int(digits[x:x+5])
        else:continue
    return n
        
        


def solution(digits):
    maxima = 0
    for i in range(len(digits)):
        if int(digits[i:i+5]) > maxima:
            maxima = int(digits[i:i+5])
    return maxima


def solution(digits):
    digit_ints = [int(x) for x in digits]
    max_digit = max(digit_ints)
    max_locs = [i for i in range(len(digits)) if digit_ints[i] == max_digit and i <= len(digits) - 5]
    while max_locs == []:
        max_digit -= 1
        max_locs = [i for i in range(len(digits)) if digit_ints[i] == max_digit and i <= len(digits) - 5]
    return max([int(digits[loc:loc + 5]) for loc in max_locs])

def solution(digits):
    n = 0
    for i in range(len(digits)):
        if int(digits[i:i+5])>n:
            n = int(digits[i:i+5])
        
    return n

def solution(digits):
    i=0
    j=5
    maks=0
    while j<=len(digits):
        maks=max(maks,int(digits[i:j]))
        i+=1
        j+=1
    return maks

def solution(digits):
    ans = None
    for i in range(0,len(digits)):
        if ans is None:
            ans = int(digits[i:i+5:])
        elif int(digits[i:i+5]) > ans:
            ans = int(digits[i:i+5])
    return ans

def solution(digits):
    number=0
    max=0
    for i in range(len(digits)-4):
        number=digits[i:i+5]
        number=int(number)
        if number>max:
            max=number
    return max

def solution(digits):
    number = str(digits)
    max_seq = ''
    for i in range(len(number) - 3):
        if number[i:i+5] > max_seq:
            max_seq = number[i:i+5]
    return int(max_seq)

def solution(digits):
    sl = 0
    res_list = []
    for count in range(len(digits) - 1):
        res_list.append(int(digits[sl: sl + 5]))
        sl += 1
    return max(res_list)

def solution(digits):
    digits=str(digits)
    x=[int(digits[i:i+5]) for i in range(len(digits)-4)]
    return max(x)


def solution(digits):
    largest = ''
    for i in range(len(digits) - 4):
        if digits[i:i+5] > largest:
            largest = digits[i:i+5]
    return int(largest)

def solution(digits):
    
    l = []
    
    for i in range(len(str(digits))-4):
        total = int(digits[i:i+5])
        l.append(total)
    return(max(l))
    


def solution(digits):
    cur = int(digits[:5])
    mx = cur
    for i in range(5, len(digits)):
        cur = (cur % 10000) * 10 + int(digits[i])
        if mx < cur: mx = cur
    return mx

def solution(digits):
    nw_lst=[]
    for i in range(len(digits)-4):
        nums = int(digits[i:i+5])
        nw_lst.append(nums)
    return max(nw_lst);

def solution(digits):
    maxes = max([int(digits[j:j+5]) for j,k in enumerate(digits)])
    return maxes


def solution(digits):
    lst = []
    for i in range(len(digits)):
        lst.append(digits[i:i+5])
    return int(max(lst))

def solution(digits):
    h_seq = 0
    for i in range(0, len(digits) - 4):
        if int(digits[i: i+5]) > h_seq:
            h_seq = int(digits[i: i+5])
    return h_seq

def solution(digits):
    lst = list(map(int, digits))
    answ = []
    for i in range(0, len(lst) - 4):
        x = lst[i:i+5]
        z = ''
        for j in x:
            z += str(j)
        answ.append(int(z))
    return max(answ)

def solution(digits):
    x = [digits[index:index+5] for index, value in enumerate(digits)]
    resul = max(x)
    return int(resul);

def solution(digits):
    f = lambda x: [x[i:i+5] for i in range(len(x)+1-5)]
    numbers = str(digits)
    return max(list(map(int, f(numbers))))


def solution(digits):
    max = 0
    for i in range(0, len(digits)):
        n = int(digits[i:i+5])
        if n > max:
            max = n
    
    return max

def solution(digits):
    best = 0
    
    for i in range(len(digits) - 4):
        n = int(digits[i:i + 5])
        
        if n > best:
            best = n
    
    return best


def solution(digits):
    return max([int(digits[start:start+5]) for start in range(len(digits) - 4)])

def solution(digits):
    return max([int(digits[start:start+5]) for start in range(len(digits))])


def solution(digits):
    b = int(max(digits[a:a + 5] for a in range(len(digits) - 4)))
    return b

def solution(digits):
    solution = int(digits[0:5])
    for index in range(1, len(digits)):
        current = int(digits[index:index+5])
        solution = current if current > solution else solution

    return solution

def solution(digits):
    numli=[]
    if len(digits)>5:
        for ind in range(len(digits)):
            if ind <= len(digits)-5:
                num=digits[ind:ind+5]
                numli.append(num)
    elif len(digits)<=5:
        numli.append[0]

    #print(numli)
    return int(max(numli))

def solution(digits):
    d = str(digits)
    n = 0
    for x in range(0, len(d)-4):
        if int(d[x:x+5]) > n:
            n = int(d[x:x+5])
    return n

def solution(digits):
    if digits == "":
        return 0
    splice = 5
    lst = []
    for i,v in enumerate(digits):
        lst.append(digits[i:i+splice])
    maxval = (int(max(lst)))
    return maxval


def solution(digits):
    max = 0
    for i in range(len(str(digits)) - 4):
        tmp = int(str(digits)[i:i+5])
        if tmp > max : max = tmp
    return max

def solution(digits):
    num = [digits[i:i+5] for i in range(len(digits)-4)]
    num.sort()
    return int(num[-1])


def solution(digits):
    biggest = int(digits[0:5])
    for i in range(0,int(len(digits))-4):
        if biggest<int(digits[i:i+5]):
            biggest = int(digits[i:i+5])
    return biggest

def solution(digits):
    if len(str(digits))<5:
        return digits
    
    string=str(digits)
    
    list2=[ ]

    maxi=len(string)-4
    i=0
    
    while i < maxi:
        for s, x in enumerate(string):
            list2.append(int(string[s:(s+5)]))
            i=i+1
            
    return max(list2)

def solution(digits):
    x = 0
    m = 5
    i = 0
    for i in range(len(digits)):
        if int(digits[i:i+5]) > x:
            x = int(digits[i:i+5])
            i += 1
    else:
        i += 1
    
    return x

def solution(digits):
    
    all = []
    for x in range(len(digits)):
        all.append(int(digits[x:x+5]))
    
    return max(all)

def solution(digits):   
    return max(int(digits[n:n+5]) for n in range(len(digits) - 4)) if digits else 0


def solution(digits):
    record=0
    for i in range(0,len(digits)-4):
        current = int(digits[i:i+5])
        #print(current)
        if current > record:
            record = current
    return record

def solution(d):
    s = str(d)
    return max([int(s[i:i+5]) for i in range(len(s)-4)])


import re

def solution(digits):
    
                
    numlist = [int(digits[i:i+5]) for i in range(0,len(digits)-4)]
            
    return max(numlist);

def solution(digits):
    k = 5
    ret = int(digits[0:k])
    index = 5
    while index+k < len(digits):
        temp = digits[index: index + k]
        ret = max(ret, int(temp))
        index += 1
    ret = max(ret, int(digits[index:]))
    return ret


def solution(digits):
    max_num = 0
    for index in range(len(digits)-4):
        num = int(digits[index:index+5])
        if num > max_num:
            max_num = num
    print(max_num)
    return max_num;

def solution(digits):
    ans = 0
    for i in range (0, len(digits)):
        if int(digits[i:i+5]) > ans:
            ans = int(digits[i:i+5])
    return ans

def solution(digits):
    lst = [digits[i:i+5] for i in range(0, len(digits))]
    return int(max(lst))


def solution(digits):
    n = []
    for i in range(0,len(digits)):
        s = str(digits)[i:i+5]
        n.append(s)
    new = [int(i) for i in n]
    return max(new)


def solution(digits):
    return max([int(digits[loop] + digits[loop + 1] + digits[loop + 2] + digits[loop + 3] + digits[loop + 4]) for loop in range(len(digits) - 4)])

def solution(digits):
    all = []
    j = 5
    while j <= len(digits):
        all.append(int(digits[j-5:j]))
        j+=1
    return max(all)

def solution(digits):
    x = []
    for i in range(0,len(digits)):
        x.append(int(digits[i:i+5]))
    return max(x)

def solution(d):
    return max([int(d[x:x+5]) for x in range(len(d)-4)])

def solution(digits):
    num,i=0,0
    while i <len(digits)-4:
        if int(digits[i:i+5])>num:
            num = int(digits[i:i+5])
        i+=1
    return num

def solution(digits):
    l=len(digits)
    start,end,max=0,5,0
    while 1:
        a=(digits)[start:end]
        if int(a)>max:
            max=int(a)
        start+=1
        end+=1
        if end==l+1:
            break
    return max

def solution(digits):
    maxseq = 0
    for x in range(len(digits) - 4):
        if int(digits[x:x + 5]) > maxseq:
            maxseq = int(digits[x:x + 5])
    return maxseq



def solution(digits):
    v = [digits[i:i+5] for i in range(len(digits)-4)]
    v.sort()
    return int(v[-1])

def solution(digits):
    largest = 0
    for i in range(len(digits)-4):
        sliced = int(digits[i:i+5])
        if sliced > largest:
            largest = sliced
    return largest

def solution(digits):
    b = digits
    start_rez = 0
    end_rez = 5
    max = 0

    while end_rez <= len(b) + 1:
        rez = b[start_rez:end_rez]
        if max < int(rez):
            max = int(rez)
            if end_rez < len(b):
                start_rez += 1
                end_rez += 1
        else:
            start_rez += 1
            end_rez += 1
    return int(max)

def solution(digits):
    step_index = 0
    index = 0
    step_sum = ''
    max_sum = '0'
    while step_index + 5 != len(digits) + 1:
        while index < step_index + 5:
            step_sum += digits[index]
            index = index + 1
        step_index = step_index + 1
        index = (index - 5) + 1
        if int(step_sum) > int(max_sum):
            max_sum = step_sum
        step_sum = ''
    return int(max_sum)

def solution(digits):
    number = 0
    for i in range(len(digits)):
        num = int(digits[i:i+5])
        if num > number:
            number = num
    return number;

def solution(digits):
    num = 0
    for x in range(0, len(digits)-1):
        if int(digits[x:x+5]) > int(num):
            num = digits[x:x+5] 
    return(int(num))

def solution(digits):
    if len(digits)<5:
        return int(digits)
    i=0
    ans = 0
    for j in range(len(digits)):
        while j-i+1 > 5:
            i+=1
        num = int(digits[i:j+1])
        if num > ans:
            ans = num
    
    return ans;

def solution(digits):
    def helper_func(item):
        temp = ''
        for i in item:
            temp = temp + str(i)
        return temp
    number_arr = [i for i in digits]
    result = [number_arr[i:i+5] for i in range(0, len(number_arr) - 4)]
    string_res = [helper_func(i) for i in result]
    return max([int(i) for i in string_res])



def solution(digits):
    max = 0
    seq = 0
    for d in range(0,len(digits)):
        seq = int(digits[d:d+5])
        if seq > max:
            max = seq
    return max

def solution(digits):
    numlist = [int(digits[i:i+5]) for i in range(len(digits))]
    return max(numlist)

def solution(digits):
    max_num = 0
    for i in range(len(digits)-4):
        curr_num = int(digits[i:i+5])
        if curr_num > max_num:
            max_num = curr_num
    return max_num

def solution(digits):
    numlist = [int(digits[i:i+5]) for i in range(0,len(digits)-4)]
    return max(numlist)
def solution(digits):
    return int(max(digits[a:a + 5] for a in range(len(digits) - 4)))
def solution(digits):
    result = -1;
    for i in range(len(digits)):
        current = int(digits[i: i+5])
        if current >= result:
            result = current
    return result



def solution(x):
    a=''
    i=0
    while i<=len(x)-5:
        a+=x[i:i+5] + ' '
        i+=1
    return int(max(a.split()))

def solution(digits):
    biggest = 0
    for x in range(len(digits)-4):
        num = int(digits[x]+digits[x+1]+digits[x+2]+digits[x+3]+digits[x+4])
        if num > biggest:
            biggest = num
    return biggest