1133: 单词修正(巩固提升)
Memory Limit:128 MB
Time Limit:1.000 S
Judge Style:Text Compare
Creator:
Submit:69
Solved:35
Description
已知有链表a=[["m",2],["o",0],["p",3],["u",4],["e",-1]],顺序输出为将字符串" ompue" ,现要求运用链表知识将字符串" ompue" 修正为" computer" ,完成下列程序。
Input
def bianli(list,head): #链表遍历函数
p=head
c=""
while p!=-1:
c=c+list[p][0]
p=a[p][1]
return c
a=[["m",2],["o",0],["p",3],["u",4],["e",-1]]
head=1
p=head
c=""
while p!=-1:
c=c+list[p][0]
p=a[p][1]
return c
a=[["m",2],["o",0],["p",3],["u",4],["e",-1]]
head=1
Output
computer
Sample Input Copy
Sample Output Copy
computer