':type input: str
:rtype: int'

def lengthLongestPath(self, input):

    def split_iter(s, tok):
        start = 0
        for i in xrange(len(s)):
            if (s[i] == tok):
                (yield s[start:i])
                start = (i + 1)
        (yield s[start:])
    max_len = 0
    path_len = {0: 0}
    for line in split_iter(input, '\n'):
        name = line.lstrip(' DCTB ')
        depth = (len(line) - len(name))
        if ('.' in name):
            max_len = max(max_len, (path_len[depth] + len(name)))
        else:
            path_len[(depth + 1)] = ((path_len[depth] + len(name)) + 1)
    return max_len
