Refactor UVa 315 to use function prototype (avoid cluttering the beginning of the file)