#Both examples could not be done with
#for char in word:

#Ask for a string from the keyboard.

#Check whether there is any occurrence of the substring
#c-de in the string,
#where the - can be any letter.

#Print a message "Got code." if you find the pattern
#(but only print the message once even if there are
#two occurrences of the pattern)

s = raw_input("Please enter a string: ")
found = False

for i in range(len(s)-3):
# why -3 is important? try without for 'cod'
    if s[i] == 'c' and s[i+2] == 'd' and s[i+3] == 'e':
        found = True

if found:
    print "Got code."
else:
    print "Why you no have code?"


#Ask for
#   - a string and
#   - a two-character string (character pair)
#from the keyboard.

#Find and print the index of the second occurrence of
#the pair of characters within the first string.

#Also, if there is no second occurrence of the letter pair,
#the program should say so.

#For example, if the first string is "boohoo" and
#the pair is "oo", the program should print 4.


s = raw_input("Give me a string: ")
pair = raw_input("What is the letter pair? ")
count = 0

for i in range(len(s)-1):
    if s[i] == pair[0] and s[i+1] == pair[1]:
        count += 1
        if count == 2:
            print "Second occurrence is at index",i

if count < 2:
    print "There was no second occurrence of", pair, "in", s