# Class notes from week 2
#
# String processing in Python
#
# To enter a string from the keyboard, you have to use raw_input(...),
# not input(...), because the latter only works for numerical values.
# Example:  name = raw_input("Please type in your name: ")
#
# Summary of string operations
#
# len(s) returns the character length of string s
# s[i] returns the character at position i, counting from the left starting with 0
# s[-i] returns the character at position i, counting from the RIGHT starting with 1
# s[i:j] returns the substring starting at position i, up to but not including position j
# s[i:] returns the substring starting at i and continuing to the end of the string
# s[:j] returns the substring starting at the beginning up to but not including position j
# s1+s2 returns a new string created by concatenating strings s1 and s2 together
# s*i returns i copies of a string concatenated together
#
# Examples:
#
# s = "The rain in Spain stays mainly in the plain"
# len(s) returns 43
# s[0] returns "T"
# s[4] returns "r"
# s[-1] returns "n" (the last n in the string)
# s[4:8] returns "rain"
# s[24:] returns "mainly in the plain"
# s[:24] returns "The rain in Spain stays " (the m is not included)
# word = "apple"
# word+word returns "appleapple"
# word*3 returns "appleappleapple"
#
# Other string operations are available from Python's string library:
#
# import string
# string.find(s, "ain") returns 5, the position of the first "ain" in s
# string.find(s, "ain", 10) returns 14, the position of the first "ain"
#                           that occurs from position 10 onward
# string.rfind(s, "ain") returns 40, the position of the LAST "ain" in s
# string.upper(s) returns "THE RAIN IN SPAIN STAYS MAINLY IN THE PLAIN"
# string.lower(s) returns "the rain in spain stays mainly in the plain"
#
# See the table on page 96 of the textbook for a more complete list

#-------------------------------------------------------------------------------

import string

def initials():
    name = raw_input("Enter your name (Lastname, Firstname MI): ")
    commaPosition = string.find(name, ",")
    first = name[commaPosition+2]
    middle = name[-1]
    last = name[0]
    print "Your initials are " + first + middle + last

