finish problem E of acm