求大佬解答,一直提示输入有问题

#coding = utf-8
import sys
for line in sys.stdin:     
    str1 = line.split()     
    n = len(str1)     
    str1 = str1.split('/')     
    d = []     
    res=""     
    str2 = ['','.','..']     
    for i in str1:         
        if i not in str2:             d.append(i)     
    n = str1.count("..")     
    while n:         
        d.pop()         
        n-=1     
    if d==[]:         
        print '/'     
    else:         
        for i in d:
             res+='/'+i         
        print res