When a positively charged rod is brought near the far end of the rod A a redistribution of the charges occurs in the rod A. The free electrons in the rod A are attracted towards the positively charged rod. This causes positive charges to be shifted towards the other end of the rod A. The sphere B is in contact with the positively charged end of rod A. So it also acquires a positive charge.
When the positively charged rod is removed from the faf end of rod A, the electrons return to their original state and the charges redistributes themselves and a neutral state is re-established .