#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const int n = 14;
int main(int argc, char* argv[])
{
int d[n] = { 0, 0, 2, 4, 0, 0, 0, 0, 0, 0, 2, 0, 0, 3 };
for (int z1 = 0; z1 < n; z1++)
printf("%d ",d[z1]);
printf("\n");
for (int i = 0; i < n; i++)
if (d[i] == 0)
{
int q = i+1; i++;
while (d[i] == 0) i++;
int len = abs(i-q), r = len;
if (len > 1)
{
r--;
while (--r >= 0)
{
for (int t = q; t < n; t++)
d[t] = d[t+1];
}
}
if (len > 0) { d[q] = len+1; i-=len; }
}
for (int z2 = 0; d[z2] >= 0; z2++)
printf("%d ",d[z2]);
printf("\n");
return 0;
}