Added replacement of \A with ^ and \z with $ to fix integration with judge