code
class ListNode: def __init__(self,x): self.val=x self.next=None def listToListNode(input): # Generate list from the input numbers = [int(x) for x in input().split()] # Now convert that list into linked list new = ListNode(0) head = new for number in numbers: head.next = ListNode(number) head = head.next return new.next