# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution(object):
def removeElements(self, head, val):
"""
:type head: ListNode
:type val: int
:rtype: ListNode
"""
chushihua = ListNode(-1)
chushihua.next = head
new = chushihua
while new.next:
if new.next.val == val:
new.next = new.next.next
else:
new = new.next
return chushihua.next