Workman B counts as half of workman A, so the job is completed in 18 days by 1½ workmen. It will take one workman longer to do the work by himself, so workman A would take 18*1½=27 days.
If you find this problem difficult imagine this:
The two workmen are given the job of reshelving a warehouse that's divided into 3 sections. Between them, they decide that A will cover two sections while B covers the remaining section, because he's slower than A. It will take them 18 days each to do their work. Now workman B goes sick so A has to do all the work. He completes his two sections in 18 days, but he has one more section to go. It will only take him 9 days to complete it because he works twice as fast as B. So the total number of days is 18+9=27 days. (If workman A had gone sick it would have taken B 54 days, because each section would have taken 18 days to complete; and 54=2*27.)