Cod sursa(job #46712)

Utilizator alutzuAlexandru Stoica alutzu Data 2 aprilie 2007 21:30:18
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 kb
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#define NMAX 1000000000

char s [ NMAX ] , sep [ ] = "- ,!.?;" ;

int main ( )
     {

	freopen ( "text.in" , "r" , stdin ) ;
	freopen ( "text.out" , "w" , stdout ) ;

	int n = 0;

	while ( scanf ( "%c" , s [ n ] ) != EOF ) n ++ ;

	int nr = 0 , c = 0 , si = 0 , lit = 0 ;

	for ( int i = 0 ; i <= n ; i ++ )
	    if ( isalpha ( s [ i ] ) ) {
	      if ( ! lit )
		{ si = i ; lit = 1 ; } }
	    else
		{
		   if ( si != i && lit )
		     {
			c ++ ;
			nr += ( i - si ) ;
		     }

		   lit = 0 ;

		}

	printf ( "%d" , nr / c ) ;

	return 0 ;


     }