
# SearchChar1  locates the leftmost occurrence of a character in a string.
# Inputs: s - the string to be searched
#         c - the character to be found
# Output:  the characters in  s  are printed one by one 
#   until  c  is encountered --- then  !  is printed.

s = raw_input("Type a string: ")
c = raw_input("Type a single char to search for: ")

count = 0

while count != len(s) :
    # assert: have printed  s[0] s[1] ..upto.. s[count-1],
    #   and none of them are  c
    
    if s[count] == c :
        print "!"
        break  # quits the loop here and now!
    else :
        print s[count],
        count = count + 1

# here, the loop terminated because either
# (i) c  was found at  s[count]  and "!" was printed, or
# (ii) the entire string was printed and  c  not found
print
raw_input("Press Enter to finish")