#include<stdio.h>
#include<stdlib.h>

int main()
{
char vet[]={"    super   cali   fgragilisti  "};
int b,h;
int i,j,s,k,w,y,n,g;
b=0;

// lettura e scrittura del vettore //
while(vet[b]!='\0')
{
b++;
}
printf("\nLa stringa inserita:\n\n");
//-----//
for(h=0;h<b;h++)
{
printf("%c", vet[h]);
}
printf("-\n");




// riscrittura del vettore //
b=b-1;
i=b;
j=0;
while(vet[i]==' ')
{
j++;
i--;
}
printf("\nLa stringa centrata a destra:\n\n");


for(s=0;s<j;s++)
{
for(k=b;k>=0;k--)
{
vet[k]=vet[k-1];
}
}

y=0;
for(g=b;g>=0;g--)
{
for(w=b;w>0;w--)
{
if((vet[w]==' ') && (vet[w-1]==' '))
{
for(n=w;n>0;n--)
{
vet[n]=vet[n-1];
}
}
}
}

//-----//
for(h=0;h<=b;h++)
{
printf("%c", vet[h]);
}
printf("-\n");



printf("\n");
system("PAUSE");
return 0;
}
