You are given a linked list that contains integers. You have performed the following reverse operation on the list:
Now, you are required to retrieve the original list.
Note: You should use the following definition of the linked list for this problem:
class Node {
Object data;
Node next;
}
Input format
Output format
Print the elements of the original list.
Constraints
In the sample, the original list is which when reversed according to the operations will result in the list given in the sample input.