Replaced scanf usage with fgets usage. Implemented sa(...)