rahul-and-ip-2

My dear friend Rahul was sad when nobody gave him anything important to do in URJA. So he decided to take out his anger by bringing down the URJA website. To do so he gathered some information about the IP address of the URJA website. 

The data he collected is in form of a string composed entirely of digit ('0'- '9'). Now to find a valid IP he has to check all possible IP that can be derived from the string.
A valid IP is an IP that has following property

It consist of 4 parts separated by three dots ('.').

Each part is a number in range (0 - 255).

Number in each part does not contain any leading zeros.

As Rahul is busy with a very important squash match he has asked you to help him.
Your job is to print number of IP addresses and also all possible IP addresses possible from the given string in a sorted order. 

Input:
One line containing the input string

Output:

An integer m denoting the number of possible IP's followed by m lines. 

Each line contains a valid IP address in format "XX.XX.XX.XX" (quotes for clarity).

Constraint:

0 < |s| < 18

Sample Input:

1921681107

Sample Output:

4

19.216.81.107

192.16.81.107

192.168.1.107

192.168.110.7

SAMPLE INPUT
1921681107

SAMPLE OUTPUT
4
19.216.81.107
192.16.81.107
192.168.1.107
192.168.110.7

Source: hackerearth | Difficulty: EASY


Solutions: