Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main ()
- {
- char a[100];
- int i,j,k,l,w=0,c;
- for (i=0;i<2||a[i-1]!='.'||a[i-2]!='.';i++)
- scanf ("%c",&a[i]);
- for (j=0;j<i;j++)
- {
- if (a[j]==' '&&a[j-1]==' ')
- {
- while (a[j]==' ')
- {
- for (k=j;k<i;k++)
- a[k]=a[k+1];
- i--;
- }
- }
- }
- if (a[0]>='a'&&a[0]<='z')
- a[0]-=32;
- for (c=1,j=0;j<i;j++)
- {
- if ((a[j]<'A'||a[j]>'z')&&(a[j]!=' '))
- c=0;
- if (a[j]==' ')
- {
- if (c==1)
- w++;
- c=1;
- }
- }
- for (j=0;j<i;j++)
- {
- if (a[j]==' ')
- {
- if (a[j+1]>='a'&&a[j+1]<='z')
- a[j+1]-=32;
- }
- }
- for (j=0;j<i-2;j++)
- printf ("%c",a[j]);
- printf ("\n%d",w);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement