Algorithms for anti-powers in strings