#ifdef NACHIA #define _GLIBCXX_DEBUG #else #define NDEBUG #endif #include #include #include #include using i64 = long long; using u64 = unsigned long long; #define rep(i,n) for(int i=0; i void chmin(A& l, const A& r){ if(r < l) l = r; } template void chmax(A& l, const A& r){ if(l < r) l = r; } using namespace std; #include using Modint = atcoder::static_modint<998244353>; void testcase(){ string S; cin >> S; int N = S.size(); int n = N; int ans = N; string ansS; for(int p=2; p<=N; p++) if(n%p == 0){ while(n%p == 0) n /= p; int tmp = N; string tmpS = S; int q = N / p; rep(k,q){ int X[26] = {}; for(int x=k; x tmp){ swap(ansS, tmpS); swap(ans, tmp); } } cout << ansS << endl; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); testcase(); return 0; }