South Dakota attorney general pleads no contest, avoids jail