Buggy python submission (verdict: Time Limit Exceeded):
charseq = raw_input()
start = -1
end = -1

for i in range(len(charseq)):
    for j in range(i+2, len(charseq)+1):
        part = charseq[i:j]
        chars = list(part)
        for char in chars:
            if chars.count(char) > (j-i)/2:
                start = i+1
                end = j
                break
        if not start == -1:
            break
    
print start, end 
    


Fixed submission:
charseq = raw_input()
start = -1
end = -1

for i in range(len(charseq)-1):
    if charseq[i] == charseq[i+1]:
        start = i+1 
        end = i+2 
        break
if start == -1: 
    for i in range(len(charseq)-2):
        if charseq[i] == charseq[i+2]:
            start = i+1 
            end = i+3 
            break

print start, end

Buggy python submission (verdict: Time Limit Exceeded):
charseq = raw_input()
start = -1
end = -1

for i in range(len(charseq)):
    for j in range(i+2, len(charseq)+1):
        part = charseq[i:j]
        chars = list(part)
        for char in chars:
            if chars.count(char) > (j-i)/2:
                start = i+1
                end = j
                break
        if not start == -1:
            break
    
print start, end 
    


Fixed submission:
charseq = raw_input()
start = -1
end = -1

for i in range(len(charseq)-1):
    if charseq[i] == charseq[i+1]:
        start = i+1 
        end = i+2 
        break
if start == -1: 
    for i in range(len(charseq)-2):
        if charseq[i] == charseq[i+2]:
            start = i+1 
            end = i+3 
            break

print start, end

Buggy python submission (verdict: Time Limit Exceeded):
charseq = raw_input()
start = -1
end = -1

for i in range(len(charseq)):
    for j in xrange(i+2, len(charseq)+1):
        part = charseq[i:j]
        chars = list(part)
        for char in chars:
            if chars.count(char) > (j-i)/2:
                start = i+1 
                end = j 
                break
        if not start == -1: 
            break
    
print start, end 
    


Fixed submission:
charseq = raw_input()
start = -1
end = -1

for i in range(len(charseq)-1):
    if charseq[i] == charseq[i+1]:
        start = i+1 
        end = i+2 
        break
if start == -1: 
    for i in range(len(charseq)-2):
        if charseq[i] == charseq[i+2]:
            start = i+1 
            end = i+3 
            break

print start, end

Buggy python submission (verdict: Time Limit Exceeded):
charseq = raw_input()
start = -1
end = -1

for i in xrange(len(charseq)):
    for j in xrange(i+2, len(charseq)+1):
        part = charseq[i:j]
        chars = list(part)
        counter = {}  
        for char in chars:
            counter[char] = counter.get(char, 0)+1
        for key in counter.keys():
            if counter[key] > (j-i)/2:
                start = i+1 
                end = j 
                break
        if not start == -1: 
            break
    
print start, end 
    


Fixed submission:
charseq = raw_input()
start = -1
end = -1

for i in range(len(charseq)-1):
    if charseq[i] == charseq[i+1]:
        start = i+1 
        end = i+2 
        break
if start == -1: 
    for i in range(len(charseq)-2):
        if charseq[i] == charseq[i+2]:
            start = i+1 
            end = i+3 
            break

print start, end