Bed Bath & Beyond posts profit on cost cuts