1353.Advanced search and replace -- How to format an English article will specified rules?

How to format an English article will following rules? (0) capitalize each word in first line (1) remove symbols like(1), (1,2) (2) remove ending spaces of each line (3) remove non-puctuation ended lines at the end of file (4) remove extra blank lines from two or more consecutive blank lines.

Input Sample:

Tamiflu tamiflu

At this time the medication has also been approved for flu prevention. (1,2)

They recommended that the use of the medication be reserved for those who are in a high risk group where the virus would not typically cause severe symptoms. (3,4)