Combustion and Connectivity Components
Once, you observed a fascinating process: a graph burning. Initially, the graph burns while staying connected. However, as time progresses, it begins to break into separate connected components, and eventually, these components completely burn out and vanish.
You found this process so intriguing that you decided to simulate it on your computer. To do this, you need to answer the following question: **How many connected components of unburned vertices will remain in the graph after** **i** **seconds of burning?** You need to determine the answer for each **i** from **0** to **K**, where **K** is the time when the last vertex burns.
Input
The first line contains the integers **N**, **M**, and **S** (**1** ≤ **N**, **M** ≤ **10^5**, **1** ≤ **S** ≤ **N**)—representing the number of vertices, the number of edges, and the ignition vertex, respectively. The next **M** lines describe the edges of the graph with two integers **a** and **b** (**1** ≤ **a**, **b** ≤ **N**)—the endpoints of each edge. The graph may include multiple edges and loops.
Output
On the first line, output the number **K**—the time when the last vertex burns. Assume that vertex **S** ignites at time **t=1** second, and the fire spreads to any adjacent vertex in one second. On the next line, output **K+1** numbers separated by spaces, where the **i**-th number represents the number of connected components consisting of vertices that have not yet burned at the end of **i** seconds (**0** ≤ **i** ≤ **K**).
**Explanation**: In the first example, at **0** seconds, before ignition, the graph is connected, so there is **1** connected component. At the end of the **1**st second, vertex **2** burns, splitting the graph into two components: **(5)** and **(1, 3, 4)**. After the **2**nd second, vertices **5**, **1**, and **3** burn, leaving only vertex **4** as a connected component. After the **3**rd second, vertex **4** burns, and no connected components remain, as all vertices have burned.
In the second example, at **0** seconds, the graph consists of three separate vertices, forming **3** connected components. When the first vertex ignites, it burns in the **1**st second, leaving two connected components. Since no other vertices will burn, the burning time is **1** second.