implemented script to count characters