/*
a demonstration of a "state" program.

Ray Ontko 1999/09/29
*/

#include <stdio.h>

main()
{
int c ;
int state = 0 ;
int count = 0 ;

while ( ( c = getchar() ) != EOF )
  {
  switch ( state )
    {
    case 0:
      if ( c == '/' )
        state = 1 ;
      break ;
    case 1:
      if ( c == '*' )
        state = 2 ;
      else 
        state = 0 ;
      break ;
    case 2:
      if ( c == '*' )
        state = 3 ;
      break ;
    case 3:
      if ( c == '/' )
        {
        count ++ ;
        state = 0 ;
        }
      else if ( c != '*' )
        state = 2 ;
      break ;
    }
  }
printf( "count = %d\n" , count ) ;
printf( "state = %d\n" , state ) ;
}
