%{
#include <stdio.h>
%}
%%
[+]+[0]{0,3}[-]+ { printf("(%s)", yytext); } // Match the feature and surround it with parentheses
[^+\-0\n]+ { printf("%s", yytext); } // Match any characters that are not part of the feature
[+\-0]+ { printf("%s", yytext); } // Output other parts (like isolated +, -, or 0) as is
\n { printf("\n"); } // Preserve newlines (row breaks)
%%
int main() {
yylex(); // Start the lexer
return 0;
}
int yywrap() {
return 1;
}
JXsKI2luY2x1ZGUgPHN0ZGlvLmg+CiV9CgolJQoKWytdK1swXXswLDN9Wy1dKyAgeyBwcmludGYoIiglcykiLCB5eXRleHQpOyB9ICAvLyBNYXRjaCB0aGUgZmVhdHVyZSBhbmQgc3Vycm91bmQgaXQgd2l0aCBwYXJlbnRoZXNlcwpbXitcLTBcbl0rICAgICAgICAgeyBwcmludGYoIiVzIiwgeXl0ZXh0KTsgfSAgIC8vIE1hdGNoIGFueSBjaGFyYWN0ZXJzIHRoYXQgYXJlIG5vdCBwYXJ0IG9mIHRoZSBmZWF0dXJlClsrXC0wXSsgICAgICAgICAgICB7IHByaW50ZigiJXMiLCB5eXRleHQpOyB9ICAgLy8gT3V0cHV0IG90aGVyIHBhcnRzIChsaWtlIGlzb2xhdGVkICssIC0sIG9yIDApIGFzIGlzClxuICAgICAgICAgICAgICAgICB7IHByaW50ZigiXG4iKTsgfSAgICAgICAgICAgLy8gUHJlc2VydmUgbmV3bGluZXMgKHJvdyBicmVha3MpCgolJQoKaW50IG1haW4oKSB7CiAgICB5eWxleCgpOyAgLy8gU3RhcnQgdGhlIGxleGVyCiAgICByZXR1cm4gMDsKfQoKaW50IHl5d3JhcCgpIHsKICAgIHJldHVybiAxOwp9Cg==