## Delete the Middle of the Linked List

Given a singly linked list, delete middle node of the linked list. If there are even nodes, then there would be two middle nodes, we need to delete the second middle element.
After deleting the node, print the linked list.
In case of a single node, print the head of a linked list containing only 1 node which has value -1.

#### Input

The first line contains an integer n, the length of the linked list.
The next line contains n integers, the elements of the linked list.

#### Constraints:

1 <= n <= 1000
1 <= list[i] <= 1000, where list[i] is the ith element of the list.

#### Output

Print the linked list after deleting the middle node in new line.

### Example

```5
1 2 3 4 5
```

#### Output:

```1 2 4 5
```

#### Explanation:

```After deleting middle of the linked list, 3 will be deleted and the list will be as 1, 2, 4, 5.
```

```6
1 2 3 4 5 6
```

#### Output:

```1 2 3 5 6
```

#### Explanation:

```After deleting middle of the linked list, 4 will be deleted and the list will be as 1, 2, 3, 5, 6.
```

## Solution of Delete the Middle of the Linked List:–

```import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{

class Node{
int data;
Node next;

Node(int x)
{
data=x;
next=null;
}
}

{
Node newNode = new Node(x);
{
return;
}

while(temp.next!=null)
{
temp=temp.next;
}
temp.next=newNode;
return;
}

void deleteMiddle(int n)
{
if(n==0)
{
return;
}

{
return;
}

{
return;
}

int i=0;
Node demo=null;
while(i<(n/2) && temp.next!=null)
{
demo=temp;
temp=temp.next;
i++;
}
demo.next=temp.next;
return;
}

void printList()
{

{
System.out.println(-1);
return;
}

while(temp!=null)
{
System.out.print(temp.data+" ");
temp=temp.next;
}
}

public static void main (String[] args) throws java.lang.Exception
{