> Try to avoid functions like gets and scanf.

That's a valid point. Try to use 'fgets(..., stdin)' instead!