Correction for duplicate, completely working now
Version 1, supports normal and looped automata