// compile: make data
// run: ./data < data.in
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#ifdef LOCAL
#include <debug/cpglib/print.h>
#define debug(x...) _debug_print(0, #x, x);
#define Debug(x...) _debug_print(1, #x, x);
#define DEBUG(x...) _debug_print(2, #x, x);
std::ifstream terminal("/dev/tty");
#define PP cerr<<"\033[1;30mpause...\e[0m",terminal.ignore();
#else
#define debug(x...)
#define Debug(x...)
#define DEBUG(x...)
#define PP
#endif
template<typename...Args> void print_(Args...args){((cout<<args<<" "),...)<<endl;}
#define rep(i,a,b) for(int i=(a);i<(int)(b);++i)
#define sz(v) ((int)(v).size())
#define print(...) print_(__VA_ARGS__);
#define FIND(a, x) ((find(a.begin(),a.end(),(x))!=a.end())?1:0)
#define cmin(x,...) x=min({(x),__VA_ARGS__})
#define cmax(x,...) x=max({(x),__VA_ARGS__})
#define INTMAX (int)(9223372036854775807)
#define INF (int)(1152921504606846976)
#define NaN (int)(0x8b88e1d0595d51d1)
#define double long double
#define int long long
#define uint unsigned long long
#define endl "\n"
#define MAXN 200010
template<char SP> string bwt_inv(string bwt) {
int n = bwt.length();
string sorted = bwt;
sort(sorted.begin(), sorted.end());
vector<vector<int>> v(257);
vector<int> ptr(257, 0), lshift(n);
auto order = [](char c) -> int {
return c == SP ? 0 : c + 1;
};
rep(i, 0, n) v[order(bwt[i])].push_back(i);
rep(i, 0, n) lshift[i] = v[order(sorted[i])][ptr[order(sorted[i])]++];
string orig = "";
for (int i = find(bwt.begin(), bwt.end(), SP) - bwt.begin(); i != 0; i = lshift[i]) orig += sorted[i];
return orig;
}
int32_t main() {
ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
string s; cin >> s;
cout << bwt_inv<'#'>(s) << endl;
return 0;
}
Estatisticasbravobet is great for sports bettors. Check it out before you put any money down – estatisticasbravobet
Looking for the zo88 apk download? Heard some buzz about it. Gonna grab it and see if it lives up to the hype. If you are like me, give it a go! zo88 apk download
What’s up, gamers? Gave jilislotwin a spin. Got some decent wins, but nothing crazy. Anyone hit a jackpot on this site yet? Share your stories!
Spincasinomx… I spent yesterday afternoon on this site. Excellent, I loved the selection of online games, so many to choose from, give it a try: spincasinomx
Yo, CB33! Just checked it out. Not bad, not bad at all. Solid site. Worth a look. Check it out here cb33
Jilibet777ph, Philippines represent! Had a blast playing. Good selection of games, and the payouts were decent. Highly recommend. Explore it yourself at jilibet777ph