BWT by 7gyou

#import<set>
#import<algo.h>
int i,l;using namespace std;main(){for(string p;cin>>p;puts("")){set<string>s;for(i=l=p.size(),p+=p+'z';i--;)s.insert(p.substr(i));set<string>::iterator t=s.begin();for(cout<<distance(t,s.find(p))<<' ';t!=s.end();)cout<<(*t++)[l-1];}}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page