#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<iostream>
#include<queue>
#include<map>
#define mod 998244353
using namespace std;
int n,a[100005];
long long ans = 0,tmp[105],vis[15];
void solve(int x){
	int tot = 0;
	while (x){
		tot ++;
		x /= 10;
	}
	vis[tot] ++;
}
int main(){
	scanf ("%d",&n);
	tmp[0] = 1;
	for (int i = 1;i <= 30;i ++)
		tmp[i] = (tmp[i - 1] * 10)% mod;
	for (int i = 1;i <= n;i ++){
		scanf ("%d",&a[i]);
		solve(a[i]);
	}
	for (int i = 1;i <= n;i ++){
		int b = a[i];
		int pos = 0;
		while (b){
			long long c = b % 10;
			b /= 10;
			pos ++;
			for (int j = 1;j <= 10;j ++){
				if (j >= pos){
					ans = (ans + c * vis[j] * tmp[pos * 2 - 1] % mod) % mod;
					ans = (ans + c * vis[j] * tmp[pos * 2 - 2] % mod) % mod;
				}
				else
					ans = (ans + 2 * c * vis[j] * tmp[pos + j - 1] % mod) % mod;
			}
		}
	}
	printf("%lld",ans);
}


#include <map>
#include <cmath>
#include <queue>
#include <string>
#include <vector>
#include <cstdio>
#include <cstring>
#include <utility>
#include <iostream>
#include <algorithm>

using namespace std;

template <typename T>
T Max(T x, T y) {return x > y ? x : y;}

template <typename T>
T Min(T x, T y) {return x < y ? x : y;}

template <typename T>
T Fabs(T x) {return x < 0 ? -x : x;}

#define LL long long

const LL mod = 998244353;

LL ans;
LL a[100005];
int n;
int cnt[15];

LL qkpow(LL x, int y) {
    LL ret = 1;
    while(y) {
        if(y & 1)
            ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

int main() {
    scanf("%d", &n);
    for(int i = 1; i <= n; i ++) {
        scanf("%lld", &a[i]);
        LL p = a[i];
        int w = 0;
        while(p) {
            w ++;
            p /= 10;
        }
        cnt[w] ++;
    }
    for(int i = 1; i <= n; i ++) {
        LL p = a[i];
        int w = 0;
        while(p) {
            LL y = p % 10;
            p /= 10;
            w ++;
            for(int j = 1; j <= 10; j ++) {
                if(j >= w) {
                    ans = (ans + y * cnt[j] % mod * (qkpow(1ll * 10, w * 2 - 1) % mod)) % mod;
                    ans = (ans + y * cnt[j] % mod * (qkpow(1ll * 10, w * 2 - 2) % mod)) % mod;
                }
                else
                    ans = (ans + y * 2 % mod * cnt[j] % mod * qkpow(1ll * 10, w + j - 1) % mod) % mod;
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}


#include <cstdio>
#define Int register int
const int mod = 998244353;
const int N = 100000;
typedef long long LL;

static inline char Get_Char() {
	static char buffer[100000], *S = buffer, *T = buffer;
	if (S == T) {
		T = (S = buffer) + fread(buffer, 1, 100000, stdin);
		if (S == T) return EOF;
	}
	return *S++;
}

//#define Get_Char() getchar()

static inline int Read() {
	int f = 1, x = 0;
	register char sign = Get_Char();
	for (; sign > '9' || sign < '0'; sign = Get_Char())
		if (sign == '-') f = -1;
	for (; sign >= '0' && sign <= '9'; sign = Get_Char())
		x = (x << 3) + (x << 1) + (sign ^ 48);
	return x * f;
}

LL Pre[N + 1][15][2], Ans;
int val[N + 1], Bit[15];
inline void Ready(const int Index, const int arr) {
	LL Ten = 1, Rec = arr, tmp;

	for (Int i = 1; i <= 10 && Rec; ++ i) {
		tmp = Rec % 10;
		Pre[Index][i][0] = (Pre[Index][i - 1][0] + tmp * (Ten % mod * Ten % mod) % mod * 10) % mod;
		Pre[Index][i][1] = (Pre[Index][i - 1][1] + tmp * (Ten % mod * Ten % mod) % mod) % mod;
		Ten *= 10;
		Rec /= 10;
		if (Rec == 0)
			Bit[i]++;
	}

	Rec = arr;
	Int i = 1;
	Ten = 10;
	for (; i <= 10 && Rec; ++ i) {
		Rec /= 10;
		Pre[Index][i][0] = (Pre[Index][i][0] + Rec * (Ten % mod * Ten % mod) % mod) % mod;
		Pre[Index][i][1] = (Pre[Index][i][1] + Rec * (Ten % mod * Ten % mod) % mod) % mod;
		Ten *= 10;
	}

	for (; i <= 10; ++ i){
		Pre[Index][i][0] = Pre[Index][i - 1][0];
		Pre[Index][i][1] = Pre[Index][i - 1][1];
	}
}
/*
3
12345 3456 45756
*/
int main() {
	int n = Read();
	for (Int i = 1; i <= n; ++ i) {
		val[i] = Read();
	}

	for (int i = 1; i <= n; ++ i) {
		Ready(i, val[i]);

//		printf("i==%d\n", i);
//		for (Int j = 1; j <= 10; ++ j) {
//			printf(" %d %d\n", Pre[i][j][0], Pre[i][j][1]);
//		} putchar('\n');
	}
//
//	for (Int i = 1; i <= 5; ++ i)
//		printf("%d ", Bit[i]);
//
//
	for (Int i = 1; i <= n; ++ i) {
		for (Int j = 1; j <= 10; ++ j) {
			Ans = (Ans + (Pre[i][j][0] + Pre[i][j][1]) % mod * Bit[j] % mod) % mod;
		}
		//printf("Ans = %lld\n", Ans);
	}

	printf("%lld\n", Ans);
	return 0;
}


#include<iostream>
#include<cstring>

#define MOD 998244353

using namespace std;

typedef long long ll;

int num_of_digits(int x){
	int cnt = 0;
	while(x){
		++cnt;
		x /= 10;
	}
	return cnt;
}

ll convert(int x, bool first, int y_length){
	ll rem, ten = (first ? 1 : 10), mod = 0;
	while(x){
		rem = x % 10;
		mod = (mod + (rem * ten) % MOD) % MOD;
		x /= 10;
		--y_length;
		if((first && y_length < 0) || (!first && y_length <= 0))
			ten = (ten * 10) % MOD;
		else
			ten = (ten * 100) % MOD;
	}
	return mod;
}

int main(){
	ll n, ans = 0;
	scanf("%I64d", &n);
	ll a[n], fr[11];
	memset(fr, 0, sizeof(fr));
	for(int i = 0 ; i < n ; i++){
		scanf("%I64d", a + i);
		++fr[num_of_digits(a[i])];
	}
	for(int i = 0 ; i < n ; i++){
		for(int first = 0 ; first < 2 ; first++){
			for(int j = 0 ; j < 10 ; j++){
				ans = (ans + (convert(a[i], first, j) * fr[j]) % MOD) % MOD;
			}
		}
	}
	printf("%I64d\n", ans);
	return 0;
}


#include<iostream>
#include<cstring>

#define MOD 998244353

using namespace std;

typedef long long ll;

int num_of_digits(int x){
	int cnt = 0;
	while(x){
		++cnt;
		x /= 10;
	}
	return cnt;
}

ll convert(int x, bool first, int y_length){
	ll rem, ten = (first ? 1 : 10), mod = 0;
	while(x){
		rem = x % 10;
		mod = (mod + (rem * ten) % MOD) % MOD;
		x /= 10;
		--y_length;
		if((first && y_length < 0) || (!first && y_length <= 0))
			ten = (ten * 10) % MOD;
		else
			ten = (ten * 100) % MOD;
	}
	return mod;
}

int main(){
	ll n, ans = 0;
	scanf("%I64d", &n);
	ll a[n], fr[11];
	memset(fr, 0, sizeof(fr));
	for(int i = 0 ; i < n ; i++){
		scanf("%I64d", a + i);
		++fr[num_of_digits(a[i])];
	}
	for(int i = 0 ; i < n ; i++){
		for(int first = 0 ; first < 2 ; first++){
			for(int j = 0 ; j <= 10 ; j++){
				ans = (ans + (convert(a[i], first, j) * fr[j]) % MOD) % MOD;
			}
		}
	}
	printf("%I64d\n", ans);
	return 0;
}


#include<iostream>
#include<cstring>

#define MOD 998244353

using namespace std;

typedef long long ll;

int num_of_digits(int x){
	int cnt = 0;
	while(x){
		++cnt;
		x /= 10;
	}
	return cnt;
}

int convert(int x, bool first, int y_length){
	ll rem, ten = (first ? 1 : 10), mod = 0;
	while(x){
		rem = x % 10;
		mod = (mod + (rem * ten) % MOD) % MOD;
		x /= 10;
		--y_length;
		if((first && y_length < 0) || (!first && y_length <= 0))
			ten = (ten * 10) % MOD;
		else
			ten = (ten * 100) % MOD;
	}
	return mod;
}

int main(){
	ll n, ans = 0;
	scanf("%I64d", &n);
	ll a[n], fr[11];
	memset(fr, 0, sizeof(fr));
	for(int i = 0 ; i < n ; i++){
		scanf("%I64d", a + i);
		++fr[num_of_digits(a[i])];
	}
	for(int i = 0 ; i < n ; i++){
		for(int first = 0 ; first < 2 ; first++){
			for(int j = 0 ; j < 10 ; j++){
				ans = (ans + (convert(a[i], first, j) * fr[j]) % MOD) % MOD;
			}
		}
	}
	printf("%I64d\n", ans);
	return 0;
}


#include<iostream>
#include<cstring>

#define MOD 998244353

using namespace std;

typedef long long ll;

int num_of_digits(int x){
	int cnt = 0;
	while(x){
		++cnt;
		x /= 10;
	}
	return cnt;
}

int convert(int x, bool first, int y_length){
	ll rem, ten = (first ? 1 : 10), mod = 0;
	while(x){
		rem = x % 10;
		mod = (mod + (rem * ten) % MOD) % MOD;
		x /= 10;
		--y_length;
		if((first && y_length < 0) || (!first && y_length <= 0))
			ten = (ten * 10) % MOD;
		else
			ten = (ten * 100) % MOD;
	}
	return mod;
}

int main(){
	ll n, ans = 0;
	scanf("%I64d", &n);
	ll a[n], fr[10];
	memset(fr, 0, sizeof(fr));
	for(int i = 0 ; i < n ; i++){
		scanf("%I64d", a + i);
		++fr[num_of_digits(a[i])];
	}
	for(int i = 0 ; i < n ; i++){
		for(int first = 0 ; first < 2 ; first++){
			for(int j = 0 ; j < 10 ; j++){
				ans = (ans + (convert(a[i], first, j) * fr[j]) % MOD) % MOD;
			}
		}
	}
	printf("%I64d\n", ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#define ll long long
using namespace std;
ll qian[20][100010];
ll hou[20][100010];
int cnt[20];
int cntt[100010];
ll a[100010];
ll mod=998244353;
ll ten[20];
int main()
{
	ten[0]=1;
	for(int i=1;i<=20;i++)
	{
		ten[i]=ten[i-1]*10;
		ten[i]%=mod;
	}
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%I64d",&a[i]);
		ll temp=a[i];
		int ccnt=0;
		while(temp>0)
		{
			temp/=10;
			ccnt++;
		}
		cnt[ccnt]++;
		cntt[i]=ccnt;
		for(int j=1;j<=10;j++)
		{
			ll aa=0;
			aa+=ten[2*j-1]*(a[i]/ten[j-1]);
			aa%=mod;
			ll bb=a[i];
			for(int k=0;k<j-1;k++)
			{
				aa+=ten[k*2+1]*(bb%10);
				aa%=mod;
				bb/=10;
			}
			qian[i][j]=aa;
		//	cout<<aa<<endl;
		}
		for(int j=1;j<=10;j++)
		{
			ll aa=0;
			aa+=ten[2*j]*(a[i]/ten[j]);
			aa%=mod;
			ll bb=a[i];
			for(int k=0;k<j;k++)
			{
				aa+=ten[2*k]*(bb%10);
				aa%=mod;
				bb/=10;
			}
			hou[i][j]=aa;
		//	cout<<"   "<<aa<<endl;
		}
	}
	ll res=0;
	for(int i=0;i<n;i++)
	{
		for(int j=1;j<=10;j++)
		{
			res+=(qian[i][j]*cnt[j])%mod+(hou[i][j]*cnt[j])%mod;
		}
	//	res-=qian[i][cntt[i]]+hou[i][cntt[i]];
		res%=mod;
	}
	cout<<res<<endl;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#define ll long long
using namespace std;
ll qian[100010][30];
int cnt[30];
int cntt[100010];
ll a[100010];
ll mod=998244353;
ll ten[100];
int main()
{
	ten[0]=1;
	for(int i=1;i<30;i++)
	{
		ten[i]=ten[i-1]*10;
	}
	for(int i=1;i<30;i++) ten[i]%=mod;
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%I64d",&a[i]);
		ll temp=a[i];
		int ccnt=0;
		while(temp>0)
		{
			temp/=10;
			ccnt++;
		}
		cnt[ccnt]++;
		cntt[i]=ccnt;
		for(int j=1;j<30;j++)
		{
			ll aa=0;
			ll t=a[i];
			for(int k=0;k<j;k++)
			{
				aa+=11*(t%10)*ten[k*2];
			//	cout<<11*(t%10)*ten[k*2]<<endl;
				aa%=mod;
				t/=10;
			}
			aa+=(2*t)%mod*ten[j*2];
			aa%=mod;
			qian[i][j]=aa;
		//	cout<<aa<<endl;
		}
	}
	ll res=0;
	for(int i=0;i<n;i++)
	{
		for(int j=1;j<30;j++)
		{
			res+=(qian[i][j]*cnt[j])%mod;
			res%=mod;
		}
		res%=mod;
	}
	cout<<res<<endl;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#define ll long long
using namespace std;
ll qian[20][100010];
ll hou[20][100010];
int cnt[30];
int cntt[100010];
ll a[100010];
ll mod=998244353;
ll ten[30];
int main()
{
	ten[0]=1;
	for(int i=1;i<=20;i++)
	{
		ten[i]=ten[i-1]*10;
		ten[i]%=mod;
	}
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%I64d",&a[i]);
		ll temp=a[i];
		int ccnt=0;
		while(temp>0)
		{
			temp/=10;
			ccnt++;
		}
		cnt[ccnt]++;
		cntt[i]=ccnt;
		for(int j=1;j<=10;j++)
		{
			ll aa=0;
			aa+=ten[2*j-1]*(a[i]/ten[j-1]);
			aa%=mod;
			ll bb=a[i];
			for(int k=0;k<j-1;k++)
			{
				aa+=ten[k*2+1]*(bb%10);
				aa%=mod;
				bb/=10;
			}
			qian[i][j]=aa;
		//	cout<<aa<<endl;
		}
		for(int j=1;j<=10;j++)
		{
			ll aa=0;
			aa+=ten[2*j]*(a[i]/ten[j]);
			aa%=mod;
			ll bb=a[i];
			for(int k=0;k<j;k++)
			{
				aa+=ten[2*k]*(bb%10);
				aa%=mod;
				bb/=10;
			}
			hou[i][j]=aa;
		//	cout<<"   "<<aa<<endl;
		}
	}
	ll res=0;
	for(int i=0;i<n;i++)
	{
		for(int j=1;j<=10;j++)
		{
			res+=(qian[i][j]*cnt[j])%mod+(hou[i][j]*cnt[j])%mod;
		}
	//	res-=qian[i][cntt[i]]+hou[i][cntt[i]];
		res%=mod;
	}
	cout<<res<<endl;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#define ll long long
using namespace std;
ll qian[100010][30];
ll hou[100010][30];
int cnt[30];
int cntt[100010];
ll a[100010];
ll mod=998244353;
ll ten[30];
int main()
{
	ten[0]=1;
	for(int i=1;i<30;i++)
	{
		ten[i]=ten[i-1]*10;
		ten[i]%=mod;
	}
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%I64d",&a[i]);
		ll temp=a[i];
		int ccnt=0;
		while(temp>0)
		{
			temp/=10;
			ccnt++;
		}
		cnt[ccnt]++;
		cntt[i]=ccnt;
		for(int j=1;j<30;j++)
		{
			ll aa=0;
			aa+=(ten[2*j-1]*(a[i]/ten[j-1]))%mod;
			aa%=mod;
			ll bb=a[i];
			for(int k=0;k<j-1;k++)
			{
				aa+=(ten[k*2+1]*(bb%10))%mod;
				aa%=mod;
				bb/=10;
			}
			qian[i][j]=aa;
		//	cout<<aa<<endl;
		}
		for(int j=1;j<30;j++)
		{
			ll aa=0;
			aa+=(ten[2*j]*(a[i]/ten[j]))%mod;
			aa%=mod;
			ll bb=a[i];
			for(int k=0;k<j;k++)
			{
				aa+=(ten[2*k]*(bb%10))%mod;
				aa%=mod;
				bb/=10;
			}
			hou[i][j]=aa;
		//	cout<<"   "<<aa<<endl;
		}
	}
	ll res=0;
	for(int i=0;i<n;i++)
	{
		for(int j=1;j<30;j++)
		{
			res+=(qian[i][j]*cnt[j])%mod+(hou[i][j]*cnt[j])%mod;
		}
		res%=mod;
	}
	cout<<res<<endl;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#define ll long long
using namespace std;
ll qian[100010][20];
ll hou[100010][20];
int cnt[30];
int cntt[100010];
ll a[100010];
ll mod=998244353;
ll ten[30];
int main()
{
	ten[0]=1;
	for(int i=1;i<=20;i++)
	{
		ten[i]=ten[i-1]*10;
		ten[i]%=mod;
	}
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%I64d",&a[i]);
		ll temp=a[i];
		int ccnt=0;
		while(temp>0)
		{
			temp/=10;
			ccnt++;
		}
		cnt[ccnt]++;
		cntt[i]=ccnt;
		for(int j=1;j<=10;j++)
		{
			ll aa=0;
			aa+=ten[2*j-1]*(a[i]/ten[j-1]);
			aa%=mod;
			ll bb=a[i];
			for(int k=0;k<j-1;k++)
			{
				aa+=ten[k*2+1]*(bb%10);
				aa%=mod;
				bb/=10;
			}
			qian[i][j]=aa;
		//	cout<<aa<<endl;
		}
		for(int j=1;j<=10;j++)
		{
			ll aa=0;
			aa+=ten[2*j]*(a[i]/ten[j]);
			aa%=mod;
			ll bb=a[i];
			for(int k=0;k<j;k++)
			{
				aa+=ten[2*k]*(bb%10);
				aa%=mod;
				bb/=10;
			}
			hou[i][j]=aa;
		//	cout<<"   "<<aa<<endl;
		}
	}
	ll res=0;
	for(int i=0;i<n;i++)
	{
		for(int j=1;j<=10;j++)
		{
			res+=(qian[i][j]*cnt[j])%mod+(hou[i][j]*cnt[j])%mod;
		}
	//	res-=qian[i][cntt[i]]+hou[i][cntt[i]];
		res%=mod;
	}
	cout<<res<<endl;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#define ll long long
using namespace std;
ll qian[100010][30];
ll hou[100010][30];
int cnt[30];
int cntt[100010];
ll a[100010];
ll mod=998244353;
ll ten[30];
int main()
{
	ten[0]=1;
	for(int i=1;i<30;i++)
	{
		ten[i]=ten[i-1]*10;
		ten[i]%=mod;
	}
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%I64d",&a[i]);
		ll temp=a[i];
		int ccnt=0;
		while(temp>0)
		{
			temp/=10;
			ccnt++;
		}
		cnt[ccnt]++;
		cntt[i]=ccnt;
		for(int j=1;j<30;j++)
		{
			ll aa=0;
			aa+=(ten[2*j-1]*(a[i]/ten[j-1])%mod)%mod;
			aa%=mod;
			ll bb=a[i];
			for(int k=0;k<j-1;k++)
			{
				aa+=((ten[k*2+1])*(bb%10))%mod;
				aa%=mod;
				bb/=10;
			}
			qian[i][j]=aa;
		//	cout<<aa<<endl;
		}
		for(int j=1;j<30;j++)
		{
			ll aa=0;
			aa+=((ten[2*j])*(a[i]/ten[j])%mod)%mod;
			aa%=mod;
			ll bb=a[i];
			for(int k=0;k<j;k++)
			{
				aa+=(ten[2*k]*(bb%10))%mod;
				aa%=mod;
				bb/=10;
			}
			hou[i][j]=aa;
		//	cout<<"   "<<aa<<endl;
		}
	}
	ll res=0;
	for(int i=0;i<n;i++)
	{
		for(int j=1;j<30;j++)
		{
			res+=(qian[i][j]*cnt[j])%mod+(hou[i][j]*cnt[j])%mod;
		}
		res%=mod;
	}
	cout<<res<<endl;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<map>
#include<set>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#define ll long long
using namespace std;
ll qian[100010][30];
ll hou[100010][30];
int cnt[30];
int cntt[100010];
ll a[100010];
ll mod=998244353;
ll ten[100];
int main()
{
	ten[0]=1;
	for(int i=1;i<30;i++)
	{
		ten[i]=ten[i-1]*10;
		ten[i]%=mod;
	}
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%I64d",&a[i]);
		ll temp=a[i];
		int ccnt=0;
		while(temp>0)
		{
			temp/=10;
			ccnt++;
		}
		cnt[ccnt]++;
		cntt[i]=ccnt;
		for(int j=1;j<30;j++)
		{
			ll aa=0;
			aa+=(ten[2*j-1]*(a[i]/ten[j-1])%mod)%mod;
			aa%=mod;
			ll bb=a[i];
			for(int k=0;k<j-1;k++)
			{
				aa+=((ten[k*2+1])*(bb%10))%mod;
				aa%=mod;
				bb/=10;
			}
			qian[i][j]=aa;
		//	cout<<aa<<endl;
		}
		for(int j=1;j<30;j++)
		{
			ll aa=0;
			aa+=((ten[2*j])*(a[i]/ten[j])%mod)%mod;
			aa%=mod;
			ll bb=a[i];
			for(int k=0;k<j;k++)
			{
				aa+=(ten[2*k]*(bb%10))%mod;
				aa%=mod;
				bb/=10;
			}
			hou[i][j]=aa;
		//	cout<<"   "<<aa<<endl;
		}
	}
	ll res=0;
	for(int i=0;i<n;i++)
	{
		for(int j=1;j<30;j++)
		{
			res+=(qian[i][j]*cnt[j])%mod+(hou[i][j]*cnt[j])%mod;
		}
		res%=mod;
	}
	cout<<res<<endl;
}


//#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <time.h>
#define db(x) cout << #x << " = " << x << "\n";
using namespace std;
typedef long long int ll;
const int MAX = (int)1e6+5, p = 998244353;
int A[MAX], dig[13];
int e10[] = {1, 10, 100, 1000, 10000, 100000, 1000000,
	10000000, 100000000, 1755647, 17556470, 175564700,
	757402647, 586315999, 871938225, 733427426, 346563789,
	470904831, 716070898, 172998509};

int main(){
	//std::ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	#ifdef WozMit
		clock_t _start = clock();
	#endif
	int n; while(scanf("%d", &n) == 1){
	for(int i=0; i<n; i++) scanf("%d", &A[i]);
	for(int i=0; i<13; i++) dig[i] = 0;
	int gg = 0;
	for(int i=0; i<n; i++){
		/*int x = A[i], count = 0;
		while(x > 0){
			x /= 10;
			count++;
		}
		dig[count]++;*/
		dig[(int)(log10(A[i]) + 1)]++;
	}
	for(int i=10; i>=0; i--) dig[i] += dig[i+1];
	for(int i=0; i<n; i++){
		int x = A[i], count = 1, ex = 1;
		while(x > 0){
			int add = (x % 10ll)*(dig[count])*e10[ex]%p;
			gg = (gg + add) % p;
			add = (x % 10ll)*(dig[count-1])*e10[ex-1]%p;
			gg = (gg + add) % p;
			for(int j=1; j<count; j++){
				add = (x % 10ll)*(dig[j]-dig[j+1])*e10[count+j-1]%p;
				if(j < count-1) add = (add + add) % p;
				gg = (gg + add) % p;
			}
			x /= 10;
			count++;
			ex+=2;
		}
	}
	printf("%d\n", gg);}
	#ifdef WozMit
		printf("%30c Executed in %.3f s.", 32, (double)(clock() - _start)/CLOCKS_PER_SEC);
		//cout<<string(30,' ')<<"Executed in "<<(double)(clock()-_start)/CLOCKS_PER_SEC<<"s\n";
	#endif
	return 0;
}


//#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <time.h>
#define db(x) cout << #x << " = " << x << "\n";
using namespace std;
typedef long long int ll;
const int MAX = (int)1e6+5, p = 998244353;
int A[MAX], len[MAX], dig[13];
int e10[] = {1, 10, 100, 1000, 10000, 100000, 1000000,
	10000000, 100000000, 1755647, 17556470, 175564700,
	757402647, 586315999, 871938225, 733427426, 346563789,
	470904831, 716070898, 172998509};

int main(){
	//std::ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	#ifdef WozMit
		clock_t _start = clock();
	#endif
	int n; while(scanf("%d", &n) == 1){
	for(int i=0; i<n; i++) scanf("%d", &A[i]);
	for(int i=0; i<13; i++) dig[i] = 0;
	int gg = 0;
	for(int i=0; i<n; i++){
		int x = A[i], count = 0;
		while(x > 0){
			int add = (x % 10ll)*(e10[2*count] + e10[2*count+1])%p;
			gg = (gg + add) % p;
			x /= 10;
			count++;
		}
		len[i] = count;
		dig[count]++;
		//cout << A[i] << " ";
	}
	//cout << endl;
	for(int i=10; i>=0; i--) dig[i] += dig[i+1];
	for(int i=0; i<n; i++){
		//db(A[i]);
		int x = A[i], count = 1, ex = 1;
		while(x > 0){
			int add = (x % 10ll)*(dig[count]-1ll)*e10[ex]%p;
			gg = (gg + add) % p;
			add = (x % 10ll)*(dig[count-1]-1ll)*e10[ex-1]%p;
			gg = (gg + add) % p;
			for(int j=1; j<count; j++){
				add = (x % 10ll)*(dig[j]-dig[j+1])*e10[count+j-1]%p;
				gg = (gg + add) % p;
			}
			for(int j=1; j<count-1; j++){
				add = (x % 10ll)*(dig[j]-dig[j+1])*e10[count+j-1]%p;
				gg = (gg + add) % p;
			}
			x /= 10;
			count++;
			ex+=2;
		}
	}
	printf("%d\n", gg);}
	#ifdef WozMit
		printf("%30c Executed in %.3f s.", 32, (double)(clock() - _start)/CLOCKS_PER_SEC);
		//cout<<string(30,' ')<<"Executed in "<<(double)(clock()-_start)/CLOCKS_PER_SEC<<"s\n";
	#endif
	return 0;
}


//#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <time.h>
#define db(x) cout << #x << " = " << x << "\n";
using namespace std;
typedef long long int ll;
const int MAX = (int)1e6+5, p = 998244353;
int A[MAX], len[MAX], dig[13];
int e10[] = {1, 10, 100, 1000, 10000, 100000, 1000000,
	10000000, 100000000, 1755647, 17556470, 175564700,
	757402647, 586315999, 871938225, 733427426, 346563789,
	470904831, 716070898, 172998509};

int main(){
	//std::ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	#ifdef WozMit
		clock_t _start = clock();
	#endif
	int n; while(scanf("%d", &n) == 1){
	for(int i=0; i<n; i++) scanf("%d", &A[i]);
	for(int i=0; i<13; i++) dig[i] = 0;
	int gg = 0;
	for(int i=0; i<n; i++){
		int x = A[i], count = 0;
		while(x > 0){
			int add = (x % 10ll)*(e10[2*count] + e10[2*count+1])%p;
			//gg = (gg + add) % p;
			x /= 10;
			count++;
		}
		//len[i] = count;
		dig[count]++;
		//cout << A[i] << " ";
	}
	//cout << endl;
	for(int i=10; i>=0; i--) dig[i] += dig[i+1];
	for(int i=0; i<n; i++){
		//db(A[i]);
		int x = A[i], count = 1, ex = 1;
		while(x > 0){
			int add = (x % 10ll)*(dig[count])*e10[ex]%p;
			gg = (gg + add) % p;
			add = (x % 10ll)*(dig[count-1])*e10[ex-1]%p;
			gg = (gg + add) % p;
			for(int j=1; j<count; j++){
				add = (x % 10ll)*(dig[j]-dig[j+1])*e10[count+j-1]%p;
				if(j < count-1) add = (add + add) % p;
				gg = (gg + add) % p;
			}
			/*for(int j=1; j<count-1; j++){
				add = (x % 10ll)*(dig[j]-dig[j+1])*e10[count+j-1]%p;
				gg = (gg + add) % p;
			}*/
			x /= 10;
			count++;
			ex+=2;
		}
	}
	printf("%d\n", gg);}
	#ifdef WozMit
		printf("%30c Executed in %.3f s.", 32, (double)(clock() - _start)/CLOCKS_PER_SEC);
		//cout<<string(30,' ')<<"Executed in "<<(double)(clock()-_start)/CLOCKS_PER_SEC<<"s\n";
	#endif
	return 0;
}


//#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <time.h>
#define db(x) cout << #x << " = " << x << "\n";
using namespace std;
typedef long long int ll;
const int MAX = (int)1e6+5, p = 998244353;
int A[MAX], len[MAX], dig[13];
int e10[] = {1, 10, 100, 1000, 10000, 100000, 1000000,
	10000000, 100000000, 1755647, 17556470, 175564700,
	757402647, 586315999, 871938225, 733427426, 346563789,
	470904831, 716070898, 172998509};

int main(){
	//std::ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	#ifdef WozMit
		clock_t _start = clock();
	#endif
	int n; while(scanf("%d", &n) == 1){
	for(int i=0; i<n; i++) scanf("%d", &A[i]);
	for(int i=0; i<13; i++) dig[i] = 0;
	int gg = 0;
	for(int i=0; i<n; i++){
		int x = A[i], count = 0;
		while(x > 0){
			int add = (x % 10ll)*(e10[2*count] + e10[2*count+1])%p;
			gg = (gg + add) % p;
			x /= 10;
			count++;
		}
		len[i] = count;
		dig[count]++;
		//cout << A[i] << " ";
	}
	//cout << endl;
	for(int i=10; i>=0; i--) dig[i] += dig[i+1];
	for(int i=0; i<n; i++){
		//db(A[i]);
		int x = A[i], count = 1, ex = 1;
		while(x > 0){
			int add = (x % 10ll)*(dig[count]-1ll)*e10[ex]%p;
			gg = (gg + add) % p;
			add = (x % 10ll)*(dig[count-1]-1ll)*e10[ex-1]%p;
			gg = (gg + add) % p;
			for(int j=1; j<count; j++){
				add = (x % 10ll)*(dig[j]-dig[j+1])*e10[count+j-1]%p;
				if(j < count-1) add = (add + add) % p;
				gg = (gg + add) % p;
			}
			/*for(int j=1; j<count-1; j++){
				add = (x % 10ll)*(dig[j]-dig[j+1])*e10[count+j-1]%p;
				gg = (gg + add) % p;
			}*/
			x /= 10;
			count++;
			ex+=2;
		}
	}
	printf("%d\n", gg);}
	#ifdef WozMit
		printf("%30c Executed in %.3f s.", 32, (double)(clock() - _start)/CLOCKS_PER_SEC);
		//cout<<string(30,' ')<<"Executed in "<<(double)(clock()-_start)/CLOCKS_PER_SEC<<"s\n";
	#endif
	return 0;
}


//#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <time.h>
#define db(x) cout << #x << " = " << x << "\n";
using namespace std;
typedef long long int ll;
const int MAX = (int)1e6+5, p = 998244353;
int A[MAX], len[MAX], dig[13];
int e10[] = {1, 10, 100, 1000, 10000, 100000, 1000000,
	10000000, 100000000, 1755647, 17556470, 175564700,
	757402647, 586315999, 871938225, 733427426, 346563789,
	470904831, 716070898, 172998509};

int main(){
	//std::ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	#ifdef WozMit
		clock_t _start = clock();
	#endif
	int n; while(scanf("%d", &n) == 1){
	for(int i=0; i<n; i++) scanf("%d", &A[i]);
	for(int i=0; i<13; i++) dig[i] = 0;
	int gg = 0;
	for(int i=0; i<n; i++){
		int x = A[i], count = 0;
		while(x > 0){
			int add = (x % 10ll)*(e10[2*count] + e10[2*count+1])%p;
			gg = (gg + add) % p;
			x /= 10;
			count++;
		}
		len[i] = count;
		dig[count]++;
		//cout << A[i] << " ";
	}
	//cout << endl;
	for(int i=10; i>=0; i--) dig[i] += dig[i+1];
	for(int i=0; i<n; i++){
		//db(A[i]);
		int x = A[i], count = 1, ex = 1;
		while(x > 0){
			int add = (x % 10ll)*(dig[count]-1ll)*e10[ex]%p;
			gg = (gg + add) % p;
			add = (x % 10ll)*(dig[count-1]-1ll)*e10[ex-1]%p;
			gg = (gg + add) % p;
			for(int j=1; j<count; j++){
				add = (x % 10ll)*(dig[j]-dig[j+1])*e10[count+j-1]%p;
				gg = (gg + add) % p;
			}
			x /= 10;
			count++;
			ex+=2;
		}
	}
	printf("%d\n", gg);}
	#ifdef WozMit
		printf("%30c Executed in %.3f s.", 32, (double)(clock() - _start)/CLOCKS_PER_SEC);
		//cout<<string(30,' ')<<"Executed in "<<(double)(clock()-_start)/CLOCKS_PER_SEC<<"s\n";
	#endif
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=998244353;
int n,a[100005];
vector<int>vec[11];
int read(){
  int x=0,f=1;char ch=getchar();
  while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
  while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
  return x*f;
}
int digit(int x){
    if(x==0) return 1;
    int ret=0;
    while(x){
        ret++;
        x/=10;
    }
    return ret;
}

int calc(int x){
    int ret=0;
    vector<int>tar;
    while(x){
        tar.push_back(x%10);
        x/=10;
    }
    reverse(tar.begin(),tar.end());
    for(int i=0;i<tar.size();++i){
        ret*=100,ret%=MOD;
        ret+=tar[i],ret%=MOD;
    }
    return ret;
}

signed main(){
    n=read();
    int mi[12];
    mi[0]=1;
    for(int i=1;i<=12;++i) mi[i]=mi[i-1]*10%MOD;
    for(int i=1;i<=n;++i) a[i]=read();
    for(int i=1;i<=n;++i)
        vec[digit(a[i])].push_back(a[i]);
    int ans=0;
#define SIZE (vec[j].size())
    for(int i=1;i<=10;++i){
        for(auto num:vec[i])
            for(int j=1;j<=10;++j){// j weishu
                if(i<=j){
                    ans+=11LL*calc(num)*SIZE%MOD;
                }
                else{
                    int part1=num%mi[j];
                    int part2=num-part1;
                    ans+=11LL*calc(part1)%MOD*SIZE%MOD;
                    ans%=MOD;
                    ans+=2LL*SIZE*part2%MOD*mi[j]%MOD;
                    ans%=MOD;
                }
            }
    }
    cout<<ans<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=998244353;
int n,a[1000005];
vector<int>vec[12];
int read(){
  int x=0,f=1;char ch=getchar();
  while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
  while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
  return x*f;
}
int digit(int x){
    if(x==0) return 1;
    int ret=0;
    while(x){
        ret++;
        x/=10;
    }
    return ret;
}

int calc(int x){
    int ret=0;
    vector<int>tar;
    while(x){
        tar.push_back(x%10);
        x/=10;
    }
    reverse(tar.begin(),tar.end());
    for(int i=0;i<tar.size();++i){
        ret*=100,ret%=MOD;
        ret+=tar[i],ret%=MOD;
    }
    return ret;
}

signed main(){
    n=read();
    int mi[12];
    mi[0]=1;
    for(int i=1;i<=12;++i) mi[i]=mi[i-1]*10;
    for(int i=1;i<=n;++i) a[i]=read();
    for(int i=1;i<=n;++i)
        vec[digit(a[i])].push_back(a[i]);
    int ans=0;
#define SIZE (vec[j].size())
    for(int i=0;i<=11;++i){
        for(auto num:vec[i])
            for(int j=0;j<=11;++j){// j weishu
                if(i<=j){
                    ans+=11LL*calc(num)*SIZE%MOD;
                }
                else{
                    int part1=num%mi[j];
                    int part2=num-part1;
                    ans+=11LL*calc(part1)%MOD*SIZE%MOD;
                    ans%=MOD;
                    ans+=2LL*SIZE*part2%MOD*mi[j]%MOD;
                    ans%=MOD;
                }
            }
    }
    cout<<ans%MOD<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=998244353;
int n,a[100005];
vector<int>vec[11];
int read(){
  int x=0,f=1;char ch=getchar();
  while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
  while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
  return x*f;
}
int digit(int x){
    if(x==0) return 1;
    int ret=0;
    while(x){
        ret++;
        x/=10;
    }
    return ret;
}

int calc(int x){
    int ret=0;
    if(x==0) return 1;
    vector<int>tar;
    while(x){
        tar.push_back(x%10);
        x/=10;
    }
    reverse(tar.begin(),tar.end());
    for(int i=0;i<tar.size();++i){
        ret*=100,ret%=MOD;
        ret+=tar[i],ret%=MOD;
    }
    return ret;
}

signed main(){
    n=read();
    int mi[12];
    mi[0]=1;
    for(int i=1;i<=12;++i) mi[i]=mi[i-1]*10%MOD;
    for(int i=1;i<=n;++i) a[i]=read();
    for(int i=1;i<=n;++i)
        vec[digit(a[i])].push_back(a[i]);
    int ans=0;
#define SIZE (vec[j].size())
    for(int i=1;i<=10;++i){
        for(auto num:vec[i])
            for(int j=1;j<=10;++j){// j weishu
                if(i<=j){
                    ans+=11LL*calc(num)*SIZE%MOD;
                }
                else{
                    int part1=num%mi[j];
                    int part2=num-part1;
                    ans+=11LL*calc(part1)%MOD*SIZE%MOD;
                    ans%=MOD;
                    ans+=2LL*SIZE*part2%MOD*mi[j]%MOD;
                    ans%=MOD;
                }
            }
    }
    cout<<ans%MOD<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=998244353;
int n,a[1000005];
vector<int>vec[12];
int read(){
  int x=0,f=1;char ch=getchar();
  while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
  while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
  return x*f;
}
int digit(int x){
    if(x==0) return 1;
    int ret=0;
    while(x){
        ret++;
        x/=10;
    }
    return ret;
}

int calc(int x){
    int ret=0;
    vector<int>tar;
    while(x){
        tar.push_back(x%10);
        x/=10;
    }
    reverse(tar.begin(),tar.end());
    for(int i=0;i<tar.size();++i){
        ret*=100,ret%=MOD;
        ret+=tar[i],ret%=MOD;
    }
    return ret;
}

signed main(){
    n=read();
    int mi[12];
    mi[0]=1;
    for(int i=1;i<=12;++i) mi[i]=mi[i-1]*10%MOD;
    for(int i=1;i<=n;++i) a[i]=read();
    for(int i=1;i<=n;++i)
        vec[digit(a[i])].push_back(a[i]);
    int ans=0;
#define SIZE (vec[j].size())
    for(int i=0;i<=11;++i){
        for(auto num:vec[i])
            for(int j=0;j<=11;++j){// j weishu
                if(i<=j){
                    ans+=11LL*calc(num)*SIZE%MOD;
                }
                else{
                    int part1=num%mi[j];
                    int part2=num-part1;
                    ans+=11LL*calc(part1)%MOD*SIZE%MOD;
                    ans%=MOD;
                    ans+=2LL*SIZE*part2%MOD*mi[j]%MOD;
                    ans%=MOD;
                }
            }
    }
    cout<<ans%MOD<<endl;
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define endl '\n'
#define x first
#define y second
#define sqr(a) ((a)*(a))
#define mk make_pair
#define all(a) a.begin(), a.end()

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pp;

//#define int ll
const int N = 1e5;
const int mod = 998244353;

int n;
ll ans;
int a[N];
int c[12];
ll dp[N];

ll bpow (ll a, int n) {
	ll res = 1;
	while (n) {
		if (n & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		n >>= 1;
	}
	return res;
}

main()
{
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        int j = 0, temp = a[i];
        while (temp > 0)
        {
            ++c[j];
            temp /= 10;
            ++j;
        }
    }
    for (int i = 0; i < n; ++i)
    {
        int j = 0, x;
        while (a[i] > 0)
        {
            x = a[i] % 10;
            a[i] /= 10;
            ans = (ans + (((x * c[j]) % mod) * bpow(10, 2 * j)) % mod) % mod;
            ans = (ans + (((x * c[j]) % mod) * bpow(10, 2 * j + 1)) % mod) % mod;
            for (int k = 1; k <= j; ++k)
            {
                ans = (ans + (((2 * x * (c[k - 1] - c[k])) % mod) * bpow(10, 2 * k + (j - k))) % mod) % mod;
            }
            ++j;
        }
    }
    cout << ans;
}


#include <bits/stdc++.h>
#define pb push_back
#define endl '\n'
#define x first
#define y second
#define sqr(a) ((a)*(a))
#define mk make_pair
#define all(a) a.begin(), a.end()

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pp;

//#define int ll
const int N = 1e5;
const int mod = 998244353;

int n;
ll ans;
int a[N];
int c[12];
ll dp[N];

ll bpow (ll a, int n) {
	ll res = 1;
	while (n) {
		if (n & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		n >>= 1;
	}
	return res;
}

main()
{
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        int j = 0, temp = a[i];
        while (temp > 0)
        {
            ++c[j];
            temp /= 10;
            ++j;
        }
    }
    for (int i = 0; i < n; ++i)
    {
        int j = 0, x;
        while (a[i] > 0)
        {
            x = a[i] % 10;
            a[i] /= 10;
            ans = (ans + (((x * c[j]) % mod) * bpow(10, 2 * j)) % mod) % mod;
            ans = (ans + (((x * c[j]) % mod) * bpow(10, 2 * j + 1)) % mod) % mod;
            for (int k = 1; k <= j; ++k)
            {
                ans = (ans + (((2 * x * (n - c[k])) % mod) * bpow(10, 2 * k + (j - k))) % mod) % mod;
            }
            ++j;
        }
    }
    cout << ans;
}


#include <bits/stdc++.h>
#define pb push_back
#define endl '\n'
#define x first
#define y second
#define sqr(a) ((a)*(a))
#define mk make_pair
#define all(a) a.begin(), a.end()

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pp;

//#define int ll
const int N = 1e5;
const int mod = 998244353;

int n;
ll ans;
int a[N];
int c[12];
ll dp[N];

ll bpow (ll a, int n) {
	ll res = 1;
	while (n) {
		if (n & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		n >>= 1;
	}
	return res;
}

main()
{
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        int j = 0, temp = a[i];
        while (temp > 0)
        {
            ++c[j];
            temp /= 10;
            ++j;
        }
    }
    for (int i = 0; i < n; ++i)
    {
        int j = 0, x;
        while (a[i] > 0)
        {
            x = a[i] % 10;
            a[i] /= 10;
            ans = (ans + (((x * c[j]) % mod) * bpow(10, 2 * j)) % mod) % mod;
            ans = (ans + (((x * c[j]) % mod) * bpow(10, 2 * j + 1)) % mod) % mod;
            for (int k = 1; k <= j; ++k)
            {
                ans = (ans + (((2 * x * (c[j - 1] - c[j])) % mod) * bpow(10, 2 * k + (j - k))) % mod) % mod;
            }
            ++j;
        }
    }
    cout << ans;
}


#include <bits/stdc++.h>
#define pb push_back
#define endl '\n'
#define x first
#define y second
#define sqr(a) ((a)*(a))
#define mk make_pair
#define all(a) a.begin(), a.end()

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pp;

//#define int ll
const int N = 1e5;
const int mod = 998244353;

int n;
ll ans;
int a[N];
int c[12];
ll dp[N];

ll bpow (ll a, int n) {
	ll res = 1;
	while (n) {
		if (n & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		n >>= 1;
	}
	return res;
}

main()
{
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        int j = 0, temp = a[i];
        while (temp > 0)
        {
            ++c[j];
            temp /= 10;
            ++j;
        }
    }
    for (int i = 0; i < n; ++i)
    {
        int j = 0, x;
        while (a[i] > 0)
        {
            x = a[i] % 10;
            a[i] /= 10;
            ans = (ans + (((x * c[j]) % mod) * bpow(10, 2 * j)) % mod) % mod;
            ans = (ans + (((x * c[j]) % mod) * bpow(10, 2 * j + 1)) % mod) % mod;
            for (int k = 1; k <= j; ++k)
            {
                ans = (ans + (((2 * x * (n - c[j])) % mod) * bpow(10, 2 * k + (j - k))) % mod) % mod;
            }
            ++j;
        }
    }
    cout << ans;
}


#include <bits/stdc++.h>
#define pb push_back
#define endl '\n'
#define x first
#define y second
#define sqr(a) ((a)*(a))
#define mk make_pair
#define all(a) a.begin(), a.end()

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pp;

//#define int ll
const int N = 1e5;
const int mod = 998244353;

int n;
ll ans;
int a[N];
int c[12];
ll dp[N];

ll bpow (ll a, int n) {
	ll res = 1;
	while (n) {
		if (n & 1)
			res = (res * a) % mod;
		a = (a * a) % mod;
		n >>= 1;
	}
	return res;
}

main()
{
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    //cin.tie(0);
    //cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        int j = 0, temp = a[i];
        while (temp > 0)
        {
            ++c[j];
            temp /= 10;
            ++j;
        }
    }
    for (int i = 0; i < n; ++i)
    {
        int j = 0, x;
        while (a[i] > 0)
        {
            x = a[i] % 10;
            a[i] /= 10;
            ans = (ans + (((x * c[j]) % mod) * bpow(10, 2 * j)) % mod) % mod;
            ans = (ans + (((x * c[j]) % mod) * bpow(10, 2 * j + 1)) % mod) % mod;
            ans = (ans + (((2 * x * (n - c[j])) % mod) * bpow(10, 2 * j)) % mod) % mod;
            ++j;
        }
    }
    cout << ans;
}


#include<bits/stdc++.h>
#define ms(x) memset(x,0,sizeof(x))
#define sws ios::sync_with_stdio(false)
using namespace std;
typedef long long ll;
const int maxn=5e5+5;
const ll mod=998244353;
ll vis[20];
ll val[maxn];
ll cnt[maxn];
int myco(ll x,int id){
	int co=0;
	ll t=1;
	ll sum=0;
	while(x){
		sum=(sum+x%10*t%mod)%mod;
		t=t*10%mod;
		sum=(sum+x%10*t%mod)%mod;
		x/=10;
		t=t*10%mod;
		co++;
	}
	vis[co]++;
	val[id]=sum;
	return co;
}
ll d[25];
ll f(ll x,ll y){
	ll t=1;
	ll sum=0;
	while(x){
		sum=(sum+x%10*t%mod)%mod;
		t=t*10%mod;
		sum=(sum+x%10*t%mod)%mod;
		t=t*10%mod;
		x/=10;
	}
	return sum;
}
ll a[maxn];
int main(){
	int n;
	sws;
	d[0]=1;
	for(int i=1;i<=19;i++) d[i]=d[i-1]*10;
	cin>>n;
	ll ans=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	    cnt[i]=myco(a[i],i);
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=11;j++) if(vis[j]){
			 if(j>=cnt[i]){
				ans=(ans+val[i]%mod*vis[j]%mod)%mod;
			 }
			 else{
			    int t=j;
			 	ll res=(a[i]/d[j]%mod*(d[2*j]%mod)*2%mod+f(a[i]%d[j],a[i]%d[j])%mod)%mod*vis[j]%mod;
			 	 ans=(ans+res%mod)%mod;
			 }
		}
	}
	cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define ms(x) memset(x,0,sizeof(x))
#define sws ios::sync_with_stdio(false)
using namespace std;
typedef long long ll;
const int maxn=5e5+5;
const ll mod=998244353;
int vis[20];
int val[maxn];
int cnt[maxn];
int myco(ll x,int id){
	int co=0;
	ll t=1;
	ll sum=0;
	while(x){
		sum=(sum+x%10*t%mod)%mod;
		t=t*10%mod;
		sum=(sum+x%10*t%mod)%mod;
		x/=10;
		t=t*10%mod;
		co++;
	}
	vis[co]++;
	val[id]=sum;
	return co;
}
ll d[16];
ll f(ll x,ll y){
	ll t=1;
	ll sum=0;
	while(x){
		sum=(sum+x%10*t%mod)%mod;
		t=t*10%mod;
		sum=(sum+x%10*t%mod)%mod;
		t=t*10%mod;
		x/=10;
	}
	return sum;
}
ll a[maxn];
int main(){
	int n;
	sws;
	d[0]=1;
	for(int i=1;i<=15;i++) d[i]=d[i-1]*10;
	cin>>n;
	ll ans=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	    cnt[i]=myco(a[i],i);
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=11;j++) if(vis[j]){
			 if(j>=cnt[i]){
				ans=(ans+val[i]*vis[j]%mod)%mod;
			 }
			 else{

			 	ll res=(a[i]/d[j]%mod*d[2*j]*2%mod+f(a[i]%d[j],a[i]%d[j])%mod)%mod*vis[j]%mod;
			 	 ans=(ans+res%mod)%mod;
			 }
		}
	}
	cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define ms(x) memset(x,0,sizeof(x))
#define sws ios::sync_with_stdio(false)
using namespace std;
typedef long long ll;
const int maxn=5e5+5;
const ll mod=998244353;
ll vis[20];
ll val[maxn];
ll cnt[maxn];
int myco(ll x,int id){
	int co=0;
	ll t=1;
	ll sum=0;
	while(x){
		sum=(sum+x%10*t%mod)%mod;
		t=t*10%mod;
		sum=(sum+x%10*t%mod)%mod;
		x/=10;
		t=t*10%mod;
		co++;
	}
	vis[co]++;
	val[id]=sum;
	return co;
}
ll d[16];
ll f(ll x,ll y){
	ll t=1;
	ll sum=0;
	while(x){
		sum=(sum+x%10*t%mod)%mod;
		t=t*10%mod;
		sum=(sum+x%10*t%mod)%mod;
		t=t*10%mod;
		x/=10;
	}
	return sum;
}
ll a[maxn];
int main(){
	int n;
	sws;
	d[0]=1;
	for(int i=1;i<=19;i++) d[i]=d[i-1]*10;
	cin>>n;
	ll ans=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	    cnt[i]=myco(a[i],i);
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=11;j++) if(vis[j]){
			 if(j>=cnt[i]){
				ans=(ans+val[i]%mod*vis[j]%mod)%mod;
			 }
			 else{
			    int t=j;
			 	ll res=(a[i]/d[j]%mod*(d[2*j]%mod)*2%mod+f(a[i]%d[j],a[i]%d[j])%mod)%mod*vis[j]%mod;
			 	 ans=(ans+res%mod)%mod;
			 }
		}
	}
	cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define ms(x) memset(x,0,sizeof(x))
#define sws ios::sync_with_stdio(false)
using namespace std;
typedef long long ll;
const int maxn=5e5+5;
const ll mod=998244353;
ll vis[20];
ll val[maxn];
ll cnt[maxn];
int myco(ll x,int id){
	int co=0;
	ll t=1;
	ll sum=0;
	while(x){
		sum=(sum+x%10*t%mod)%mod;
		t=t*10%mod;
		sum=(sum+x%10*t%mod)%mod;
		x/=10;
		t=t*10%mod;
		co++;
	}
	vis[co]++;
	val[id]=sum;
	return co;
}
ll d[16];
ll f(ll x,ll y){
	ll t=1;
	ll sum=0;
	while(x){
		sum=(sum+x%10*t%mod)%mod;
		t=t*10%mod;
		sum=(sum+x%10*t%mod)%mod;
		t=t*10%mod;
		x/=10;
	}
	return sum;
}
ll a[maxn];
int main(){
	int n;
	sws;
	d[0]=1;
	for(int i=1;i<=15;i++) d[i]=d[i-1]*10;
	cin>>n;
	ll ans=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	    cnt[i]=myco(a[i],i);
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=11;j++) if(vis[j]){
			 if(j>=cnt[i]){
				ans=(ans+val[i]%mod*vis[j]%mod)%mod;
			 }
			 else{

			 	ll res=(a[i]/d[j]%mod*d[2*j]*2%mod+f(a[i]%d[j],a[i]%d[j])%mod)%mod*vis[j]%mod;
			 	 ans=(ans+res%mod)%mod;
			 }
		}
	}
	cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define ms(x) memset(x,0,sizeof(x))
#define sws ios::sync_with_stdio(false)
using namespace std;
typedef long long ll;
const int maxn=5e5+5;
const ll mod=998244353;
int vis[20];
int val[maxn][2];
int cnt[maxn];
int myco(ll x,int id){
	int co=0;
	ll t=1;
	ll sum=0;
	ll res=0;
	while(x){
		res=(res+x%10*t%mod)%mod;
		t=t*10%mod;
		sum=(sum+x%10*t%mod)%mod;
		x/=10;
		t=t*10%mod;
		co++;
	}
	vis[co]++;
	val[id][0]=sum;
	val[id][1]=res;
	return co;
}
ll d[16];
ll f(ll x,int pd){
	ll t=pd==1?10:1;
	ll sum=0;
	while(x){
		sum=(sum+x%10*t%mod)%mod;
		t=t*100%mod;
		x/=10;
	}
	return sum;
}
ll a[maxn];
int main(){
	int n;
	d[0]=1;
	for(int i=1;i<=15;i++) d[i]=d[i-1]*10;
	cin>>n;
	ll ans=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	    cnt[i]=myco(a[i],i);
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=10;j++) if(vis[j]){
			 if(j>=cnt[i]){
				ans=(ans+val[i][0]*vis[j]%mod)%mod;
				ans=(ans+val[i][1]*vis[j]%mod)%mod;
			 }
			 else{
			 	int t=cnt[i]-j;
			 	ll res=(a[i]/d[t]%mod*d[2*j]%mod+f(a[i]%d[t],1)%mod)%mod;
			 	 res=(res+a[i]/d[t]%mod*d[2*j]%mod+f(a[i]%d[t],0)%mod)%mod;
			 	 ans=(ans+res)%mod;
			 }
		}
	}
	cout<<ans<<endl;
}


/*
⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⡎⣿⢾⡿⣿⡆⢸⣽⢻⣄⠹⣷⣟⣿⣄⠹⣟⣿⣿⣟⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⢸⣯⣟⣧⠘⣷⠈⡯⠛⢀⡐⢾⣟⣷⣻⣿⣿⣿⡿⡌⢿⣻⣿⣿
⣿⣿⣿⣿⣿⣿⣧⢸⡿⣟⣿⡇⢸⣯⣟⣮⢧⡈⢿⣞⡿⣦⠘⠏⣹⣿⣽⢿⣿⣿⣿⣿⣯⣿⣿⣿⡇⢸⣿⣿⣾⡆⠹⢀⣠⣾⣟⣷⡈⢿⣞⣯⢿⣿⣿⣿⢷⠘⣯⣿⣿
⣿⣿⣿⣿⣿⣿⣿⡈⣿⢿⣽⡇⠘⠛⠛⠛⠓⠓⠈⠛⠛⠟⠇⢀⢿⣻⣿⣯⢿⣿⣿⣿⣷⢿⣿⣿⠁⣾⣿⣿⣿⣧⡄⠇⣹⣿⣾⣯⣿⡄⠻⣽⣯⢿⣻⣿⣿⡇⢹⣾⣿
⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⡽⡇⢸⣿⣿⣿⣿⣿⣞⣆⠰⣶⣶⡄⢀⢻⡿⣯⣿⡽⣿⣿⣿⢯⣟⡿⢀⣿⣿⣿⣿⣿⣧⠐⣸⣿⣿⣷⣿⣿⣆⠹⣯⣿⣻⣿⣿⣿⢀⣿⢿
⣿⣿⣿⣿⣿⣿⣿⣿⠘⣯⡿⡇⢸⣿⣿⣿⣿⣿⣿⣿⣧⡈⢿⣳⠘⡄⠻⣿⢾⣽⣟⡿⣿⢯⣿⡇⢸⣿⣿⣿⣿⣿⣿⡀⢾⣿⣿⣿⣿⣿⣿⣆⠹⣾⣷⣻⣿⡿⡇⢸⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⠇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠻⡇⢹⣆⠹⣟⣾⣽⣻⣟⣿⣽⠁⣾⣿⣿⣿⣿⣿⣿⣇⣿⣿⠿⠛⠛⠉⠙⠋⢀⠁⢘⣯⣿⣿⣧⠘⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⡈⣿⡃⢼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡙⠌⣿⣆⠘⣿⣞⡿⣞⡿⡞⢠⣿⣿⣿⣿⣿⡿⠛⠉⠁⢀⣀⣠⣤⣤⣶⣶⣶⡆⢻⣽⣞⡿⣷⠈⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠘⠁⠉⠉⠉⠉⠉⠉⠉⠉⠉⠙⠛⠛⢿⣄⢻⣿⣧⠘⢯⣟⡿⣽⠁⣾⣿⣿⣿⣿⣿⡃⢀⢀⠘⠛⠿⢿⣻⣟⣯⣽⣻⣵⡀⢿⣯⣟⣿⢀⣿
⣿⣿⣿⣟⣿⣿⣿⣿⣶⣶⡆⢀⣿⣾⣿⣾⣷⣿⣶⠿⠚⠉⢀⢀⣤⣿⣷⣿⣿⣷⡈⢿⣻⢃⣼⣿⣿⣿⣿⣻⣿⣿⣿⡶⣦⣤⣄⣀⡀⠉⠛⠛⠷⣯⣳⠈⣾⡽⣾⢀⣿
⣿⢿⣿⣿⣻⣿⣿⣿⣿⣿⡿⠐⣿⣿⣿⣿⠿⠋⠁⢀⢀⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣌⣥⣾⡿⣿⣿⣷⣿⣿⢿⣷⣿⣿⣟⣾⣽⣳⢯⣟⣶⣦⣤⡾⣟⣦⠘⣿⢾⡁⢺
⣿⣻⣿⣿⡷⣿⣿⣿⣿⣿⡗⣦⠸⡿⠋⠁⢀⢀⣠⣴⢿⣿⣽⣻⢽⣾⣟⣷⣿⣟⣿⣿⣿⣳⠿⣵⣧⣼⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣽⣳⣯⣿⣿⣿⣽⢀⢷⣻⠄⠘
⣿⢷⣻⣿⣿⣷⣻⣿⣿⣿⡷⠛⣁⢀⣀⣤⣶⣿⣛⡿⣿⣮⣽⡻⣿⣮⣽⣻⢯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⢀⢸⣿⢀⡆
⠸⣟⣯⣿⣿⣷⢿⣽⣿⣿⣷⣿⣷⣆⠹⣿⣶⣯⠿⣿⣶⣟⣻⢿⣷⣽⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢀⣯⣟⢀⡇
⣇⠹⣟⣾⣻⣿⣿⢾⡽⣿⣿⣿⣿⣿⣆⢹⣶⣿⣻⣷⣯⣟⣿⣿⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢀⡿⡇⢸⡇
⣿⣆⠹⣷⡻⣽⣿⣯⢿⣽⣻⣿⣿⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⢸⣿⠇⣼⡇
⡙⠾⣆⠹⣿⣦⠛⣿⢯⣷⢿⡽⣿⣿⣿⣿⣆⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠎⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⢀⣿⣾⣣⡿⡇
⣿⣷⡌⢦⠙⣿⣿⣌⠻⣽⢯⣿⣽⣻⣿⣿⣿⣧⠩⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⢰⢣⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⢀⢀⢿⣞⣷⢿⡇
⣿⣽⣆⠹⣧⠘⣿⣿⡷⣌⠙⢷⣯⡷⣟⣿⣿⣿⣷⡀⡹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣈⠃⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢀⣴⡧⢀⠸⣿⡽⣿⢀
⢻⣽⣿⡄⢻⣷⡈⢿⣿⣿⢧⢀⠙⢿⣻⡾⣽⣻⣿⣿⣄⠌⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢁⣰⣾⣟⡿⢀⡄⢿⣟⣿⢀
⡄⢿⣿⣷⢀⠹⣟⣆⠻⣿⣿⣆⢀⣀⠉⠻⣿⡽⣯⣿⣿⣷⣈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⢀⣠⠘⣯⣷⣿⡟⢀⢆⠸⣿⡟⢸
⣷⡈⢿⣿⣇⢱⡘⢿⣷⣬⣙⠿⣧⠘⣆⢀⠈⠻⣷⣟⣾⢿⣿⣆⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⣠⡞⢡⣿⢀⣿⣿⣿⠇⡄⢸⡄⢻⡇⣼
⣿⣷⡈⢿⣿⡆⢣⡀⠙⢾⣟⣿⣿⣷⡈⠂⠘⣦⡈⠿⣯⣿⢾⣿⣆⠙⠻⠿⠿⠿⠿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢋⣠⣾⡟⢠⣿⣿⢀⣿⣿⡟⢠⣿⢈⣧⠘⢠⣿
⣿⣿⣿⣄⠻⣿⡄⢳⡄⢆⡙⠾⣽⣿⣿⣆⡀⢹⡷⣄⠙⢿⣿⡾⣿⣆⢀⡀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣀⣠⣴⡿⣯⠏⣠⣿⣿⡏⢸⣿⡿⢁⣿⣿⢀⣿⠆⢸⣿
⣿⣿⣿⣿⣦⡙⣿⣆⢻⡌⢿⣶⢤⣉⣙⣿⣷⡀⠙⠽⠷⠄⠹⣿⣟⣿⣆⢙⣋⣤⣤⣤⣄⣀⢀⢀⢀⢀⣾⣿⣟⡷⣯⡿⢃⣼⣿⣿⣿⠇⣼⡟⣡⣿⣿⣿⢀⡿⢠⠈⣿
⣿⣿⣿⣿⣿⣷⣮⣿⣿⣿⡌⠁⢤⣤⣤⣤⣬⣭⣴⣶⣶⣶⣆⠈⢻⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣷⣶⣤⣌⣉⡘⠛⠻⠶⣿⣿⣿⣿⡟⣰⣫⣴⣿⣿⣿⣿⠄⣷⣿⣿⣿
*/

#include <bits/stdc++.h>

using namespace std;

//#define MULTITEST

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sqr(a) ((a) * (a))
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out << "(" << a.x << ", " << a.y << ")";
}

template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
	out << "[";
	forn(i, sz(v)) {
		if(i) out << ", ";
		out << v[i];
	}
	return out << "]";
}

mt19937 rnd(time(NULL));

const int INF = int(1e9);
const li INF64 = li(1e18);
const int MOD = int(1e9) + 7;
const ld EPS = 1e-9;
const ld PI = acos(-1.0);

const int N = 50 * 1000 + 13;

int n;
string s;

bool read () {
	static char buf[N];
	if (scanf("%s", buf) != 1)
		return false;
	s = buf;
	n = sz(s);
	return true;
}

// Don't forget to modify the string to avoid cyclic comparisons if needed

// lcp doesn't work with cyclic comparisons
// c_i - number of the distinct suffixes that are smaller than s[i..n]
// pos_i - i-th suffix in the sufarray is s[pos_i..n]

struct sparse_table {
	vector<vector<int>> st;
	vector<int> pw;

	sparse_table() {}

	sparse_table(const vector<int> &a) {
		int n = sz(a);
		int logn = 32 - __builtin_clz(n);
		st.resize(logn, vector<int>(n));
		forn(i, n)
			st[0][i] = a[i];
		fore(j, 1, logn) forn(i, n) {
			st[j][i] = st[j - 1][i];
			if (i + (1 << (j - 1)) < n)
				st[j][i] = min(st[j][i], st[j - 1][i + (1 << (j - 1))]);
		}
		pw.resize(n + 1);
		pw[0] = pw[1] = 0;
		fore(i, 2, n + 1)
			pw[i] = pw[i >> 1] + 1;
	}

	int get(int l, int r) {
		if (l >= r) return INF;
		int len = pw[r - l];
		return min(st[len][l], st[len][r - (1 << len)]);
	}
};

struct suffix_array {
	vector<int> c, pos;
	vector<pair<pt, int>> p, nw;
	vector<int> cnt;
	int n;

	void radix_sort(int max_al) {
		cnt.assign(max_al, 0);
		forn(i, n) ++cnt[p[i].x.y];
		fore(i, 1, max_al) cnt[i] += cnt[i - 1];
		nw.resize(n);
		forn(i, n) nw[--cnt[p[i].x.y]] = p[i];
		cnt.assign(max_al, 0);
		forn(i, n) ++cnt[nw[i].x.x];
		fore(i, 1, max_al) cnt[i] += cnt[i - 1];
		for (int i = n - 1; i >= 0; --i) p[--cnt[nw[i].x.x]] = nw[i];
	}

	vector<int> lcp;
	sparse_table st;

	int get_lcp(int l, int r) {
		l = c[l], r = c[r];
		if (l > r) swap(l, r);
		return st.get(l, r);
	}

	suffix_array(const string &s) {
		n = sz(s);
		c = vector<int>(all(s));
		int max_al = *max_element(all(c)) + 1;
		p.resize(n);
		for (int k = 1; k < n; k <<= 1) {
			for (int i = 0, j = k; i < n; ++i, j = (j + 1 == n ? 0 : j + 1))
				p[i] = mp(mp(c[i], c[j]), i);
			radix_sort(max_al);
			c[p[0].y] = 0;
			fore(i, 1, n) c[p[i].y] = c[p[i - 1].y] + (p[i].x != p[i - 1].x);
			max_al = c[p.back().y] + 1;
		}
		lcp.resize(n);
		int l = 0;
		forn(i, n) {
			l = max(0, l - 1);
			if (c[i] == n - 1)
				continue;
			while (i + l < n && p[c[i] + 1].y + l < n && s[i + l] == s[p[c[i] + 1].y + l])
				++l;
			lcp[c[i]] = l;
		}
		pos.resize(n);
		forn(i, n)
			pos[i] = p[i].y;
		st = sparse_table(lcp);
	}
};

void solve(){
	fore(k, 1, sz(s) / 2 + 1){
		suffix_array s1(s + " ");
		reverse(all(s));
		suffix_array s2(s + " ");
		reverse(all(s));
		vector<int> pos;
		int cnt = n / k;
		forn(i, cnt){
			int lensu = min(k, s2.get_lcp(n - (i * k), n - ((i + 1) * k)));
			int lenpr = min(k, s1.get_lcp(i * k, (i + 1) * k));
			if (lensu + lenpr >= k && lenpr > 0){
				if (pos.empty() || pos.back() + k <= i * k - lensu)
					pos.pb(i * k - lensu);
				else
					pos.pb(pos.back() + k);
			}
		}
		if (pos.empty())
			continue;
		string t = "";
		int j = 0;
		forn(i, n){
			if (j < sz(pos) && pos[j] == i){
				i += k - 1;
				++j;
				continue;
			}
			t += s[i];
		}
		s = t;
		n = sz(s);
	}
	puts(s.c_str());
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int tt = clock();

#endif

	cerr.precision(15);
	cout.precision(15);
	cerr << fixed;
	cout << fixed;

#ifdef MULTITEST
	int tc;
	scanf("%d", &tc);
	while(tc--){
		read();
#else
	while(read()) {
#endif
		solve();

#ifdef _DEBUG
	cerr << "TIME = " << clock() - tt << endl;
	tt = clock();
#endif

	}
}


/*
⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⡎⣿⢾⡿⣿⡆⢸⣽⢻⣄⠹⣷⣟⣿⣄⠹⣟⣿⣿⣟⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⢸⣯⣟⣧⠘⣷⠈⡯⠛⢀⡐⢾⣟⣷⣻⣿⣿⣿⡿⡌⢿⣻⣿⣿
⣿⣿⣿⣿⣿⣿⣧⢸⡿⣟⣿⡇⢸⣯⣟⣮⢧⡈⢿⣞⡿⣦⠘⠏⣹⣿⣽⢿⣿⣿⣿⣿⣯⣿⣿⣿⡇⢸⣿⣿⣾⡆⠹⢀⣠⣾⣟⣷⡈⢿⣞⣯⢿⣿⣿⣿⢷⠘⣯⣿⣿
⣿⣿⣿⣿⣿⣿⣿⡈⣿⢿⣽⡇⠘⠛⠛⠛⠓⠓⠈⠛⠛⠟⠇⢀⢿⣻⣿⣯⢿⣿⣿⣿⣷⢿⣿⣿⠁⣾⣿⣿⣿⣧⡄⠇⣹⣿⣾⣯⣿⡄⠻⣽⣯⢿⣻⣿⣿⡇⢹⣾⣿
⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⡽⡇⢸⣿⣿⣿⣿⣿⣞⣆⠰⣶⣶⡄⢀⢻⡿⣯⣿⡽⣿⣿⣿⢯⣟⡿⢀⣿⣿⣿⣿⣿⣧⠐⣸⣿⣿⣷⣿⣿⣆⠹⣯⣿⣻⣿⣿⣿⢀⣿⢿
⣿⣿⣿⣿⣿⣿⣿⣿⠘⣯⡿⡇⢸⣿⣿⣿⣿⣿⣿⣿⣧⡈⢿⣳⠘⡄⠻⣿⢾⣽⣟⡿⣿⢯⣿⡇⢸⣿⣿⣿⣿⣿⣿⡀⢾⣿⣿⣿⣿⣿⣿⣆⠹⣾⣷⣻⣿⡿⡇⢸⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⠇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠻⡇⢹⣆⠹⣟⣾⣽⣻⣟⣿⣽⠁⣾⣿⣿⣿⣿⣿⣿⣇⣿⣿⠿⠛⠛⠉⠙⠋⢀⠁⢘⣯⣿⣿⣧⠘⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⡈⣿⡃⢼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡙⠌⣿⣆⠘⣿⣞⡿⣞⡿⡞⢠⣿⣿⣿⣿⣿⡿⠛⠉⠁⢀⣀⣠⣤⣤⣶⣶⣶⡆⢻⣽⣞⡿⣷⠈⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠘⠁⠉⠉⠉⠉⠉⠉⠉⠉⠉⠙⠛⠛⢿⣄⢻⣿⣧⠘⢯⣟⡿⣽⠁⣾⣿⣿⣿⣿⣿⡃⢀⢀⠘⠛⠿⢿⣻⣟⣯⣽⣻⣵⡀⢿⣯⣟⣿⢀⣿
⣿⣿⣿⣟⣿⣿⣿⣿⣶⣶⡆⢀⣿⣾⣿⣾⣷⣿⣶⠿⠚⠉⢀⢀⣤⣿⣷⣿⣿⣷⡈⢿⣻⢃⣼⣿⣿⣿⣿⣻⣿⣿⣿⡶⣦⣤⣄⣀⡀⠉⠛⠛⠷⣯⣳⠈⣾⡽⣾⢀⣿
⣿⢿⣿⣿⣻⣿⣿⣿⣿⣿⡿⠐⣿⣿⣿⣿⠿⠋⠁⢀⢀⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣌⣥⣾⡿⣿⣿⣷⣿⣿⢿⣷⣿⣿⣟⣾⣽⣳⢯⣟⣶⣦⣤⡾⣟⣦⠘⣿⢾⡁⢺
⣿⣻⣿⣿⡷⣿⣿⣿⣿⣿⡗⣦⠸⡿⠋⠁⢀⢀⣠⣴⢿⣿⣽⣻⢽⣾⣟⣷⣿⣟⣿⣿⣿⣳⠿⣵⣧⣼⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣽⣳⣯⣿⣿⣿⣽⢀⢷⣻⠄⠘
⣿⢷⣻⣿⣿⣷⣻⣿⣿⣿⡷⠛⣁⢀⣀⣤⣶⣿⣛⡿⣿⣮⣽⡻⣿⣮⣽⣻⢯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⢀⢸⣿⢀⡆
⠸⣟⣯⣿⣿⣷⢿⣽⣿⣿⣷⣿⣷⣆⠹⣿⣶⣯⠿⣿⣶⣟⣻⢿⣷⣽⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢀⣯⣟⢀⡇
⣇⠹⣟⣾⣻⣿⣿⢾⡽⣿⣿⣿⣿⣿⣆⢹⣶⣿⣻⣷⣯⣟⣿⣿⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢀⡿⡇⢸⡇
⣿⣆⠹⣷⡻⣽⣿⣯⢿⣽⣻⣿⣿⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⢸⣿⠇⣼⡇
⡙⠾⣆⠹⣿⣦⠛⣿⢯⣷⢿⡽⣿⣿⣿⣿⣆⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠎⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⢀⣿⣾⣣⡿⡇
⣿⣷⡌⢦⠙⣿⣿⣌⠻⣽⢯⣿⣽⣻⣿⣿⣿⣧⠩⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⢰⢣⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⢀⢀⢿⣞⣷⢿⡇
⣿⣽⣆⠹⣧⠘⣿⣿⡷⣌⠙⢷⣯⡷⣟⣿⣿⣿⣷⡀⡹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣈⠃⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢀⣴⡧⢀⠸⣿⡽⣿⢀
⢻⣽⣿⡄⢻⣷⡈⢿⣿⣿⢧⢀⠙⢿⣻⡾⣽⣻⣿⣿⣄⠌⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢁⣰⣾⣟⡿⢀⡄⢿⣟⣿⢀
⡄⢿⣿⣷⢀⠹⣟⣆⠻⣿⣿⣆⢀⣀⠉⠻⣿⡽⣯⣿⣿⣷⣈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⢀⣠⠘⣯⣷⣿⡟⢀⢆⠸⣿⡟⢸
⣷⡈⢿⣿⣇⢱⡘⢿⣷⣬⣙⠿⣧⠘⣆⢀⠈⠻⣷⣟⣾⢿⣿⣆⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⣠⡞⢡⣿⢀⣿⣿⣿⠇⡄⢸⡄⢻⡇⣼
⣿⣷⡈⢿⣿⡆⢣⡀⠙⢾⣟⣿⣿⣷⡈⠂⠘⣦⡈⠿⣯⣿⢾⣿⣆⠙⠻⠿⠿⠿⠿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢋⣠⣾⡟⢠⣿⣿⢀⣿⣿⡟⢠⣿⢈⣧⠘⢠⣿
⣿⣿⣿⣄⠻⣿⡄⢳⡄⢆⡙⠾⣽⣿⣿⣆⡀⢹⡷⣄⠙⢿⣿⡾⣿⣆⢀⡀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣀⣠⣴⡿⣯⠏⣠⣿⣿⡏⢸⣿⡿⢁⣿⣿⢀⣿⠆⢸⣿
⣿⣿⣿⣿⣦⡙⣿⣆⢻⡌⢿⣶⢤⣉⣙⣿⣷⡀⠙⠽⠷⠄⠹⣿⣟⣿⣆⢙⣋⣤⣤⣤⣄⣀⢀⢀⢀⢀⣾⣿⣟⡷⣯⡿⢃⣼⣿⣿⣿⠇⣼⡟⣡⣿⣿⣿⢀⡿⢠⠈⣿
⣿⣿⣿⣿⣿⣷⣮⣿⣿⣿⡌⠁⢤⣤⣤⣤⣬⣭⣴⣶⣶⣶⣆⠈⢻⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣷⣶⣤⣌⣉⡘⠛⠻⠶⣿⣿⣿⣿⡟⣰⣫⣴⣿⣿⣿⣿⠄⣷⣿⣿⣿
*/

#include <bits/stdc++.h>

using namespace std;

//#define MULTITEST

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sqr(a) ((a) * (a))
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out << "(" << a.x << ", " << a.y << ")";
}

template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
	out << "[";
	forn(i, sz(v)) {
		if(i) out << ", ";
		out << v[i];
	}
	return out << "]";
}

mt19937 rnd(time(NULL));

const int INF = int(1e9);
const li INF64 = li(1e18);
const int MOD = int(1e9) + 7;
const ld EPS = 1e-9;
const ld PI = acos(-1.0);

const int N = 50 * 1000 + 13;

int n;
string s;

bool read () {
	static char buf[N];
	if (scanf("%s", buf) != 1)
		return false;
	s = buf;
	n = sz(s);
	return true;
}

// Don't forget to modify the string to avoid cyclic comparisons if needed

// lcp doesn't work with cyclic comparisons
// c_i - number of the distinct suffixes that are smaller than s[i..n]
// pos_i - i-th suffix in the sufarray is s[pos_i..n]

struct sparse_table {
	vector<vector<int>> st;
	vector<int> pw;

	sparse_table() {}

	sparse_table(const vector<int> &a) {
		int n = sz(a);
		int logn = 32 - __builtin_clz(n);
		st.resize(logn, vector<int>(n));
		forn(i, n)
			st[0][i] = a[i];
		fore(j, 1, logn) forn(i, n) {
			st[j][i] = st[j - 1][i];
			if (i + (1 << (j - 1)) < n)
				st[j][i] = min(st[j][i], st[j - 1][i + (1 << (j - 1))]);
		}
		pw.resize(n + 1);
		pw[0] = pw[1] = 0;
		fore(i, 2, n + 1)
			pw[i] = pw[i >> 1] + 1;
	}

	int get(int l, int r) {
		if (l >= r) return INF;
		int len = pw[r - l];
		return min(st[len][l], st[len][r - (1 << len)]);
	}
};

struct suffix_array {
	vector<int> c, pos;
	vector<pair<pt, int>> p, nw;
	vector<int> cnt;
	int n;

	void radix_sort(int max_al) {
		cnt.assign(max_al, 0);
		forn(i, n) ++cnt[p[i].x.y];
		fore(i, 1, max_al) cnt[i] += cnt[i - 1];
		nw.resize(n);
		forn(i, n) nw[--cnt[p[i].x.y]] = p[i];
		cnt.assign(max_al, 0);
		forn(i, n) ++cnt[nw[i].x.x];
		fore(i, 1, max_al) cnt[i] += cnt[i - 1];
		for (int i = n - 1; i >= 0; --i) p[--cnt[nw[i].x.x]] = nw[i];
	}

	vector<int> lcp;
	sparse_table st;

	int get_lcp(int l, int r) {
		l = c[l], r = c[r];
		if (l > r) swap(l, r);
		return st.get(l, r);
	}

	suffix_array(const string &s) {
		n = sz(s);
		c = vector<int>(all(s));
		int max_al = *max_element(all(c)) + 1;
		p.resize(n);
		for (int k = 1; k < n; k <<= 1) {
			for (int i = 0, j = k; i < n; ++i, j = (j + 1 == n ? 0 : j + 1))
				p[i] = mp(mp(c[i], c[j]), i);
			radix_sort(max_al);
			c[p[0].y] = 0;
			fore(i, 1, n) c[p[i].y] = c[p[i - 1].y] + (p[i].x != p[i - 1].x);
			max_al = c[p.back().y] + 1;
		}
		lcp.resize(n);
		int l = 0;
		forn(i, n) {
			l = max(0, l - 1);
			if (c[i] == n - 1)
				continue;
			while (i + l < n && p[c[i] + 1].y + l < n && s[i + l] == s[p[c[i] + 1].y + l])
				++l;
			lcp[c[i]] = l;
		}
		pos.resize(n);
		forn(i, n)
			pos[i] = p[i].y;
		st = sparse_table(lcp);
	}
};

void solve(){
	bool fl = false;
	suffix_array s1(s + " ");
	reverse(all(s));
	suffix_array s2(s + " ");
	reverse(all(s));
	fore(k, 1, sz(s) / 2 + 1){
		if (fl){
			s1 = suffix_array(s + " ");
			reverse(all(s));
			s2 = suffix_array(s + " ");
			reverse(all(s));
			fl = false;
		}
		vector<int> pos;
		int cnt = n / k;
		forn(i, cnt){
			int j = i;
			while (j + 1 < cnt && s1.get_lcp(j * k, (j + 1) * k) >= k)
				++j;
			int cur = j - i + 1;
			int lensu = s2.get_lcp(n - (i * k), n - ((i + 1) * k));
			if (lensu + s1.get_lcp(j * k, (j + 1) * k) >= k)
				++cur;
			if (cur > 1){
				pos.pb(i * k - lensu);
				forn(_, cur - 2) pos.pb(pos.back() + k);
			}
			i = j;
		}
		//cerr << pos << endl;
		if (pos.empty())
			continue;
		string t = "";
		int j = 0;
		forn(i, n){
			if (j < sz(pos) && pos[j] == i){
				i += k - 1;
				++j;
				continue;
			}
			t += s[i];
		}
		s = t;
		n = sz(s);
		fl = true;
	}
	puts(s.c_str());
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int tt = clock();

#endif

	cerr.precision(15);
	cout.precision(15);
	cerr << fixed;
	cout << fixed;

#ifdef MULTITEST
	int tc;
	scanf("%d", &tc);
	while(tc--){
		read();
#else
	while(read()) {
#endif
		solve();

#ifdef _DEBUG
	cerr << "TIME = " << clock() - tt << endl;
	tt = clock();
#endif

	}
}


/*
⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⡎⣿⢾⡿⣿⡆⢸⣽⢻⣄⠹⣷⣟⣿⣄⠹⣟⣿⣿⣟⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⢸⣯⣟⣧⠘⣷⠈⡯⠛⢀⡐⢾⣟⣷⣻⣿⣿⣿⡿⡌⢿⣻⣿⣿
⣿⣿⣿⣿⣿⣿⣧⢸⡿⣟⣿⡇⢸⣯⣟⣮⢧⡈⢿⣞⡿⣦⠘⠏⣹⣿⣽⢿⣿⣿⣿⣿⣯⣿⣿⣿⡇⢸⣿⣿⣾⡆⠹⢀⣠⣾⣟⣷⡈⢿⣞⣯⢿⣿⣿⣿⢷⠘⣯⣿⣿
⣿⣿⣿⣿⣿⣿⣿⡈⣿⢿⣽⡇⠘⠛⠛⠛⠓⠓⠈⠛⠛⠟⠇⢀⢿⣻⣿⣯⢿⣿⣿⣿⣷⢿⣿⣿⠁⣾⣿⣿⣿⣧⡄⠇⣹⣿⣾⣯⣿⡄⠻⣽⣯⢿⣻⣿⣿⡇⢹⣾⣿
⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⡽⡇⢸⣿⣿⣿⣿⣿⣞⣆⠰⣶⣶⡄⢀⢻⡿⣯⣿⡽⣿⣿⣿⢯⣟⡿⢀⣿⣿⣿⣿⣿⣧⠐⣸⣿⣿⣷⣿⣿⣆⠹⣯⣿⣻⣿⣿⣿⢀⣿⢿
⣿⣿⣿⣿⣿⣿⣿⣿⠘⣯⡿⡇⢸⣿⣿⣿⣿⣿⣿⣿⣧⡈⢿⣳⠘⡄⠻⣿⢾⣽⣟⡿⣿⢯⣿⡇⢸⣿⣿⣿⣿⣿⣿⡀⢾⣿⣿⣿⣿⣿⣿⣆⠹⣾⣷⣻⣿⡿⡇⢸⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⠇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠻⡇⢹⣆⠹⣟⣾⣽⣻⣟⣿⣽⠁⣾⣿⣿⣿⣿⣿⣿⣇⣿⣿⠿⠛⠛⠉⠙⠋⢀⠁⢘⣯⣿⣿⣧⠘⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⡈⣿⡃⢼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡙⠌⣿⣆⠘⣿⣞⡿⣞⡿⡞⢠⣿⣿⣿⣿⣿⡿⠛⠉⠁⢀⣀⣠⣤⣤⣶⣶⣶⡆⢻⣽⣞⡿⣷⠈⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠘⠁⠉⠉⠉⠉⠉⠉⠉⠉⠉⠙⠛⠛⢿⣄⢻⣿⣧⠘⢯⣟⡿⣽⠁⣾⣿⣿⣿⣿⣿⡃⢀⢀⠘⠛⠿⢿⣻⣟⣯⣽⣻⣵⡀⢿⣯⣟⣿⢀⣿
⣿⣿⣿⣟⣿⣿⣿⣿⣶⣶⡆⢀⣿⣾⣿⣾⣷⣿⣶⠿⠚⠉⢀⢀⣤⣿⣷⣿⣿⣷⡈⢿⣻⢃⣼⣿⣿⣿⣿⣻⣿⣿⣿⡶⣦⣤⣄⣀⡀⠉⠛⠛⠷⣯⣳⠈⣾⡽⣾⢀⣿
⣿⢿⣿⣿⣻⣿⣿⣿⣿⣿⡿⠐⣿⣿⣿⣿⠿⠋⠁⢀⢀⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣌⣥⣾⡿⣿⣿⣷⣿⣿⢿⣷⣿⣿⣟⣾⣽⣳⢯⣟⣶⣦⣤⡾⣟⣦⠘⣿⢾⡁⢺
⣿⣻⣿⣿⡷⣿⣿⣿⣿⣿⡗⣦⠸⡿⠋⠁⢀⢀⣠⣴⢿⣿⣽⣻⢽⣾⣟⣷⣿⣟⣿⣿⣿⣳⠿⣵⣧⣼⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣽⣳⣯⣿⣿⣿⣽⢀⢷⣻⠄⠘
⣿⢷⣻⣿⣿⣷⣻⣿⣿⣿⡷⠛⣁⢀⣀⣤⣶⣿⣛⡿⣿⣮⣽⡻⣿⣮⣽⣻⢯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⢀⢸⣿⢀⡆
⠸⣟⣯⣿⣿⣷⢿⣽⣿⣿⣷⣿⣷⣆⠹⣿⣶⣯⠿⣿⣶⣟⣻⢿⣷⣽⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢀⣯⣟⢀⡇
⣇⠹⣟⣾⣻⣿⣿⢾⡽⣿⣿⣿⣿⣿⣆⢹⣶⣿⣻⣷⣯⣟⣿⣿⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢀⡿⡇⢸⡇
⣿⣆⠹⣷⡻⣽⣿⣯⢿⣽⣻⣿⣿⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⢸⣿⠇⣼⡇
⡙⠾⣆⠹⣿⣦⠛⣿⢯⣷⢿⡽⣿⣿⣿⣿⣆⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠎⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⢀⣿⣾⣣⡿⡇
⣿⣷⡌⢦⠙⣿⣿⣌⠻⣽⢯⣿⣽⣻⣿⣿⣿⣧⠩⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⢰⢣⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⢀⢀⢿⣞⣷⢿⡇
⣿⣽⣆⠹⣧⠘⣿⣿⡷⣌⠙⢷⣯⡷⣟⣿⣿⣿⣷⡀⡹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣈⠃⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢀⣴⡧⢀⠸⣿⡽⣿⢀
⢻⣽⣿⡄⢻⣷⡈⢿⣿⣿⢧⢀⠙⢿⣻⡾⣽⣻⣿⣿⣄⠌⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢁⣰⣾⣟⡿⢀⡄⢿⣟⣿⢀
⡄⢿⣿⣷⢀⠹⣟⣆⠻⣿⣿⣆⢀⣀⠉⠻⣿⡽⣯⣿⣿⣷⣈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⢀⣠⠘⣯⣷⣿⡟⢀⢆⠸⣿⡟⢸
⣷⡈⢿⣿⣇⢱⡘⢿⣷⣬⣙⠿⣧⠘⣆⢀⠈⠻⣷⣟⣾⢿⣿⣆⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⣠⡞⢡⣿⢀⣿⣿⣿⠇⡄⢸⡄⢻⡇⣼
⣿⣷⡈⢿⣿⡆⢣⡀⠙⢾⣟⣿⣿⣷⡈⠂⠘⣦⡈⠿⣯⣿⢾⣿⣆⠙⠻⠿⠿⠿⠿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢋⣠⣾⡟⢠⣿⣿⢀⣿⣿⡟⢠⣿⢈⣧⠘⢠⣿
⣿⣿⣿⣄⠻⣿⡄⢳⡄⢆⡙⠾⣽⣿⣿⣆⡀⢹⡷⣄⠙⢿⣿⡾⣿⣆⢀⡀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣀⣠⣴⡿⣯⠏⣠⣿⣿⡏⢸⣿⡿⢁⣿⣿⢀⣿⠆⢸⣿
⣿⣿⣿⣿⣦⡙⣿⣆⢻⡌⢿⣶⢤⣉⣙⣿⣷⡀⠙⠽⠷⠄⠹⣿⣟⣿⣆⢙⣋⣤⣤⣤⣄⣀⢀⢀⢀⢀⣾⣿⣟⡷⣯⡿⢃⣼⣿⣿⣿⠇⣼⡟⣡⣿⣿⣿⢀⡿⢠⠈⣿
⣿⣿⣿⣿⣿⣷⣮⣿⣿⣿⡌⠁⢤⣤⣤⣤⣬⣭⣴⣶⣶⣶⣆⠈⢻⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣷⣶⣤⣌⣉⡘⠛⠻⠶⣿⣿⣿⣿⡟⣰⣫⣴⣿⣿⣿⣿⠄⣷⣿⣿⣿
*/

#include <bits/stdc++.h>

using namespace std;

//#define MULTITEST

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sqr(a) ((a) * (a))
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out << "(" << a.x << ", " << a.y << ")";
}

template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
	out << "[";
	forn(i, sz(v)) {
		if(i) out << ", ";
		out << v[i];
	}
	return out << "]";
}

mt19937 rnd(time(NULL));

const int INF = int(1e9);
const li INF64 = li(1e18);
const int MOD = int(1e9) + 7;
const ld EPS = 1e-9;
const ld PI = acos(-1.0);

const int N = 50 * 1000 + 13;

int n;
string s;

bool read () {
	static char buf[N];
	if (scanf("%s", buf) != 1)
		return false;
	s = buf;
	n = sz(s);
	return true;
}

// Don't forget to modify the string to avoid cyclic comparisons if needed

// lcp doesn't work with cyclic comparisons
// c_i - number of the distinct suffixes that are smaller than s[i..n]
// pos_i - i-th suffix in the sufarray is s[pos_i..n]

struct sparse_table {
	vector<vector<int>> st;
	vector<int> pw;

	sparse_table() {}

	sparse_table(const vector<int> &a) {
		int n = sz(a);
		int logn = 32 - __builtin_clz(n);
		st.resize(logn, vector<int>(n));
		forn(i, n)
			st[0][i] = a[i];
		fore(j, 1, logn) forn(i, n) {
			st[j][i] = st[j - 1][i];
			if (i + (1 << (j - 1)) < n)
				st[j][i] = min(st[j][i], st[j - 1][i + (1 << (j - 1))]);
		}
		pw.resize(n + 1);
		pw[0] = pw[1] = 0;
		fore(i, 2, n + 1)
			pw[i] = pw[i >> 1] + 1;
	}

	int get(int l, int r) {
		if (l >= r) return INF;
		int len = pw[r - l];
		return min(st[len][l], st[len][r - (1 << len)]);
	}
};

struct suffix_array {
	vector<int> c, pos;
	vector<pair<pt, int>> p, nw;
	vector<int> cnt;
	int n;

	void radix_sort(int max_al) {
		cnt.assign(max_al, 0);
		forn(i, n) ++cnt[p[i].x.y];
		fore(i, 1, max_al) cnt[i] += cnt[i - 1];
		nw.resize(n);
		forn(i, n) nw[--cnt[p[i].x.y]] = p[i];
		cnt.assign(max_al, 0);
		forn(i, n) ++cnt[nw[i].x.x];
		fore(i, 1, max_al) cnt[i] += cnt[i - 1];
		for (int i = n - 1; i >= 0; --i) p[--cnt[nw[i].x.x]] = nw[i];
	}

	vector<int> lcp;
	sparse_table st;

	int get_lcp(int l, int r) {
		l = c[l], r = c[r];
		if (l > r) swap(l, r);
		return st.get(l, r);
	}

	suffix_array(const string &s) {
		n = sz(s);
		c = vector<int>(all(s));
		int max_al = *max_element(all(c)) + 1;
		p.resize(n);
		for (int k = 1; k < n; k <<= 1) {
			for (int i = 0, j = k; i < n; ++i, j = (j + 1 == n ? 0 : j + 1))
				p[i] = mp(mp(c[i], c[j]), i);
			radix_sort(max_al);
			c[p[0].y] = 0;
			fore(i, 1, n) c[p[i].y] = c[p[i - 1].y] + (p[i].x != p[i - 1].x);
			max_al = c[p.back().y] + 1;
		}
		lcp.resize(n);
		int l = 0;
		forn(i, n) {
			l = max(0, l - 1);
			if (c[i] == n - 1)
				continue;
			while (i + l < n && p[c[i] + 1].y + l < n && s[i + l] == s[p[c[i] + 1].y + l])
				++l;
			lcp[c[i]] = l;
		}
		pos.resize(n);
		forn(i, n)
			pos[i] = p[i].y;
		st = sparse_table(lcp);
	}
};

void solve(){
	bool fl = false;
	suffix_array s1(s + " ");
	reverse(all(s));
	suffix_array s2(s + " ");
	reverse(all(s));
	fore(k, 1, sz(s) / 2 + 1){
		if (fl){
			s1 = suffix_array(s + " ");
			reverse(all(s));
			s2 = suffix_array(s + " ");
			reverse(all(s));
			fl = false;
		}
		vector<int> pos;
		int cnt = n / k;
		forn(i, cnt){
			int lensu = min(k, s2.get_lcp(n - (i * k), n - ((i + 1) * k)));
			int lenpr = min(k, s1.get_lcp(i * k, (i + 1) * k));
			//cerr << lensu << " " << lenpr << endl;

			if (lensu + lenpr >= k){
				if (pos.empty() || pos.back() + k <= i * k)
					pos.pb(i * k - lensu);
				else
					pos.pb(pos.back() + k);
			}
		}
		pos.resize(unique(all(pos)) - pos.begin());
		//cerr << pos << endl;
		if (pos.empty())
			continue;
		string t = "";
		int j = 0;
		forn(i, n){
			if (j < sz(pos) && pos[j] == i){
				i += k - 1;
				++j;
				continue;
			}
			t += s[i];
		}
		s = t;
		n = sz(s);
		fl = true;
	}
	puts(s.c_str());
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int tt = clock();

#endif

	cerr.precision(15);
	cout.precision(15);
	cerr << fixed;
	cout << fixed;

#ifdef MULTITEST
	int tc;
	scanf("%d", &tc);
	while(tc--){
		read();
#else
	while(read()) {
#endif
		solve();

#ifdef _DEBUG
	cerr << "TIME = " << clock() - tt << endl;
	tt = clock();
#endif

	}
}


/*
⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⡎⣿⢾⡿⣿⡆⢸⣽⢻⣄⠹⣷⣟⣿⣄⠹⣟⣿⣿⣟⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⢸⣯⣟⣧⠘⣷⠈⡯⠛⢀⡐⢾⣟⣷⣻⣿⣿⣿⡿⡌⢿⣻⣿⣿
⣿⣿⣿⣿⣿⣿⣧⢸⡿⣟⣿⡇⢸⣯⣟⣮⢧⡈⢿⣞⡿⣦⠘⠏⣹⣿⣽⢿⣿⣿⣿⣿⣯⣿⣿⣿⡇⢸⣿⣿⣾⡆⠹⢀⣠⣾⣟⣷⡈⢿⣞⣯⢿⣿⣿⣿⢷⠘⣯⣿⣿
⣿⣿⣿⣿⣿⣿⣿⡈⣿⢿⣽⡇⠘⠛⠛⠛⠓⠓⠈⠛⠛⠟⠇⢀⢿⣻⣿⣯⢿⣿⣿⣿⣷⢿⣿⣿⠁⣾⣿⣿⣿⣧⡄⠇⣹⣿⣾⣯⣿⡄⠻⣽⣯⢿⣻⣿⣿⡇⢹⣾⣿
⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⡽⡇⢸⣿⣿⣿⣿⣿⣞⣆⠰⣶⣶⡄⢀⢻⡿⣯⣿⡽⣿⣿⣿⢯⣟⡿⢀⣿⣿⣿⣿⣿⣧⠐⣸⣿⣿⣷⣿⣿⣆⠹⣯⣿⣻⣿⣿⣿⢀⣿⢿
⣿⣿⣿⣿⣿⣿⣿⣿⠘⣯⡿⡇⢸⣿⣿⣿⣿⣿⣿⣿⣧⡈⢿⣳⠘⡄⠻⣿⢾⣽⣟⡿⣿⢯⣿⡇⢸⣿⣿⣿⣿⣿⣿⡀⢾⣿⣿⣿⣿⣿⣿⣆⠹⣾⣷⣻⣿⡿⡇⢸⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⠇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠻⡇⢹⣆⠹⣟⣾⣽⣻⣟⣿⣽⠁⣾⣿⣿⣿⣿⣿⣿⣇⣿⣿⠿⠛⠛⠉⠙⠋⢀⠁⢘⣯⣿⣿⣧⠘⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⡈⣿⡃⢼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡙⠌⣿⣆⠘⣿⣞⡿⣞⡿⡞⢠⣿⣿⣿⣿⣿⡿⠛⠉⠁⢀⣀⣠⣤⣤⣶⣶⣶⡆⢻⣽⣞⡿⣷⠈⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠘⠁⠉⠉⠉⠉⠉⠉⠉⠉⠉⠙⠛⠛⢿⣄⢻⣿⣧⠘⢯⣟⡿⣽⠁⣾⣿⣿⣿⣿⣿⡃⢀⢀⠘⠛⠿⢿⣻⣟⣯⣽⣻⣵⡀⢿⣯⣟⣿⢀⣿
⣿⣿⣿⣟⣿⣿⣿⣿⣶⣶⡆⢀⣿⣾⣿⣾⣷⣿⣶⠿⠚⠉⢀⢀⣤⣿⣷⣿⣿⣷⡈⢿⣻⢃⣼⣿⣿⣿⣿⣻⣿⣿⣿⡶⣦⣤⣄⣀⡀⠉⠛⠛⠷⣯⣳⠈⣾⡽⣾⢀⣿
⣿⢿⣿⣿⣻⣿⣿⣿⣿⣿⡿⠐⣿⣿⣿⣿⠿⠋⠁⢀⢀⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣌⣥⣾⡿⣿⣿⣷⣿⣿⢿⣷⣿⣿⣟⣾⣽⣳⢯⣟⣶⣦⣤⡾⣟⣦⠘⣿⢾⡁⢺
⣿⣻⣿⣿⡷⣿⣿⣿⣿⣿⡗⣦⠸⡿⠋⠁⢀⢀⣠⣴⢿⣿⣽⣻⢽⣾⣟⣷⣿⣟⣿⣿⣿⣳⠿⣵⣧⣼⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣽⣳⣯⣿⣿⣿⣽⢀⢷⣻⠄⠘
⣿⢷⣻⣿⣿⣷⣻⣿⣿⣿⡷⠛⣁⢀⣀⣤⣶⣿⣛⡿⣿⣮⣽⡻⣿⣮⣽⣻⢯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⢀⢸⣿⢀⡆
⠸⣟⣯⣿⣿⣷⢿⣽⣿⣿⣷⣿⣷⣆⠹⣿⣶⣯⠿⣿⣶⣟⣻⢿⣷⣽⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢀⣯⣟⢀⡇
⣇⠹⣟⣾⣻⣿⣿⢾⡽⣿⣿⣿⣿⣿⣆⢹⣶⣿⣻⣷⣯⣟⣿⣿⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢀⡿⡇⢸⡇
⣿⣆⠹⣷⡻⣽⣿⣯⢿⣽⣻⣿⣿⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⢸⣿⠇⣼⡇
⡙⠾⣆⠹⣿⣦⠛⣿⢯⣷⢿⡽⣿⣿⣿⣿⣆⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠎⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⢀⣿⣾⣣⡿⡇
⣿⣷⡌⢦⠙⣿⣿⣌⠻⣽⢯⣿⣽⣻⣿⣿⣿⣧⠩⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⢰⢣⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⢀⢀⢿⣞⣷⢿⡇
⣿⣽⣆⠹⣧⠘⣿⣿⡷⣌⠙⢷⣯⡷⣟⣿⣿⣿⣷⡀⡹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣈⠃⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢀⣴⡧⢀⠸⣿⡽⣿⢀
⢻⣽⣿⡄⢻⣷⡈⢿⣿⣿⢧⢀⠙⢿⣻⡾⣽⣻⣿⣿⣄⠌⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢁⣰⣾⣟⡿⢀⡄⢿⣟⣿⢀
⡄⢿⣿⣷⢀⠹⣟⣆⠻⣿⣿⣆⢀⣀⠉⠻⣿⡽⣯⣿⣿⣷⣈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⢀⣠⠘⣯⣷⣿⡟⢀⢆⠸⣿⡟⢸
⣷⡈⢿⣿⣇⢱⡘⢿⣷⣬⣙⠿⣧⠘⣆⢀⠈⠻⣷⣟⣾⢿⣿⣆⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⣠⡞⢡⣿⢀⣿⣿⣿⠇⡄⢸⡄⢻⡇⣼
⣿⣷⡈⢿⣿⡆⢣⡀⠙⢾⣟⣿⣿⣷⡈⠂⠘⣦⡈⠿⣯⣿⢾⣿⣆⠙⠻⠿⠿⠿⠿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢋⣠⣾⡟⢠⣿⣿⢀⣿⣿⡟⢠⣿⢈⣧⠘⢠⣿
⣿⣿⣿⣄⠻⣿⡄⢳⡄⢆⡙⠾⣽⣿⣿⣆⡀⢹⡷⣄⠙⢿⣿⡾⣿⣆⢀⡀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣀⣠⣴⡿⣯⠏⣠⣿⣿⡏⢸⣿⡿⢁⣿⣿⢀⣿⠆⢸⣿
⣿⣿⣿⣿⣦⡙⣿⣆⢻⡌⢿⣶⢤⣉⣙⣿⣷⡀⠙⠽⠷⠄⠹⣿⣟⣿⣆⢙⣋⣤⣤⣤⣄⣀⢀⢀⢀⢀⣾⣿⣟⡷⣯⡿⢃⣼⣿⣿⣿⠇⣼⡟⣡⣿⣿⣿⢀⡿⢠⠈⣿
⣿⣿⣿⣿⣿⣷⣮⣿⣿⣿⡌⠁⢤⣤⣤⣤⣬⣭⣴⣶⣶⣶⣆⠈⢻⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣷⣶⣤⣌⣉⡘⠛⠻⠶⣿⣿⣿⣿⡟⣰⣫⣴⣿⣿⣿⣿⠄⣷⣿⣿⣿
*/

#include <bits/stdc++.h>

using namespace std;

//#define MULTITEST

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sqr(a) ((a) * (a))
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out << "(" << a.x << ", " << a.y << ")";
}

template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
	out << "[";
	forn(i, sz(v)) {
		if(i) out << ", ";
		out << v[i];
	}
	return out << "]";
}

mt19937 rnd(time(NULL));

const int INF = int(1e9);
const li INF64 = li(1e18);
const int MOD = int(1e9) + 7;
const ld EPS = 1e-9;
const ld PI = acos(-1.0);

const int N = 50 * 1000 + 13;

int n;
string s;

bool read () {
	static char buf[N];
	if (scanf("%s", buf) != 1)
		return false;
	s = buf;
	n = sz(s);
	return true;
}

// Don't forget to modify the string to avoid cyclic comparisons if needed

// lcp doesn't work with cyclic comparisons
// c_i - number of the distinct suffixes that are smaller than s[i..n]
// pos_i - i-th suffix in the sufarray is s[pos_i..n]

struct sparse_table {
	vector<vector<int>> st;
	vector<int> pw;

	sparse_table() {}

	sparse_table(const vector<int> &a) {
		int n = sz(a);
		int logn = 32 - __builtin_clz(n);
		st.resize(logn, vector<int>(n));
		forn(i, n)
			st[0][i] = a[i];
		fore(j, 1, logn) forn(i, n) {
			st[j][i] = st[j - 1][i];
			if (i + (1 << (j - 1)) < n)
				st[j][i] = min(st[j][i], st[j - 1][i + (1 << (j - 1))]);
		}
		pw.resize(n + 1);
		pw[0] = pw[1] = 0;
		fore(i, 2, n + 1)
			pw[i] = pw[i >> 1] + 1;
	}

	int get(int l, int r) {
		if (l >= r) return INF;
		int len = pw[r - l];
		return min(st[len][l], st[len][r - (1 << len)]);
	}
};

struct suffix_array {
	vector<int> c, pos;
	vector<pair<pt, int>> p, nw;
	vector<int> cnt;
	int n;

	void radix_sort(int max_al) {
		cnt.assign(max_al, 0);
		forn(i, n) ++cnt[p[i].x.y];
		fore(i, 1, max_al) cnt[i] += cnt[i - 1];
		nw.resize(n);
		forn(i, n) nw[--cnt[p[i].x.y]] = p[i];
		cnt.assign(max_al, 0);
		forn(i, n) ++cnt[nw[i].x.x];
		fore(i, 1, max_al) cnt[i] += cnt[i - 1];
		for (int i = n - 1; i >= 0; --i) p[--cnt[nw[i].x.x]] = nw[i];
	}

	vector<int> lcp;
	sparse_table st;

	int get_lcp(int l, int r) {
		l = c[l], r = c[r];
		if (l > r) swap(l, r);
		return st.get(l, r);
	}

	suffix_array(const string &s) {
		n = sz(s);
		c = vector<int>(all(s));
		int max_al = *max_element(all(c)) + 1;
		p.resize(n);
		for (int k = 1; k < n; k <<= 1) {
			for (int i = 0, j = k; i < n; ++i, j = (j + 1 == n ? 0 : j + 1))
				p[i] = mp(mp(c[i], c[j]), i);
			radix_sort(max_al);
			c[p[0].y] = 0;
			fore(i, 1, n) c[p[i].y] = c[p[i - 1].y] + (p[i].x != p[i - 1].x);
			max_al = c[p.back().y] + 1;
		}
		lcp.resize(n);
		int l = 0;
		forn(i, n) {
			l = max(0, l - 1);
			if (c[i] == n - 1)
				continue;
			while (i + l < n && p[c[i] + 1].y + l < n && s[i + l] == s[p[c[i] + 1].y + l])
				++l;
			lcp[c[i]] = l;
		}
		pos.resize(n);
		forn(i, n)
			pos[i] = p[i].y;
		st = sparse_table(lcp);
	}
};

void solve(){
	bool fl = true;
	fore(k, 1, sz(s) / 2 + 1){
		if (fl){
			suffix_array s1(s + " ");
			reverse(all(s));
			suffix_array s2(s + " ");
			reverse(all(s));
			fl = false;
		}
		vector<int> pos;
		int cnt = n / k;
		forn(i, cnt){
			int lensu = min(k, s2.get_lcp(n - (i * k), n - ((i + 1) * k)));
			int lenpr = min(k, s1.get_lcp(i * k, (i + 1) * k));
			if (lensu + lenpr >= k && lenpr > 0){
				if (pos.empty() || pos.back() + k <= i * k - lensu)
					pos.pb(i * k - lensu);
				else
					pos.pb(pos.back() + k);
			}
		}
		if (pos.empty())
			continue;
		string t = "";
		int j = 0;
		forn(i, n){
			if (j < sz(pos) && pos[j] == i){
				i += k - 1;
				++j;
				continue;
			}
			t += s[i];
		}
		s = t;
		n = sz(s);
		fl = true;
	}
	puts(s.c_str());
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int tt = clock();

#endif

	cerr.precision(15);
	cout.precision(15);
	cerr << fixed;
	cout << fixed;

#ifdef MULTITEST
	int tc;
	scanf("%d", &tc);
	while(tc--){
		read();
#else
	while(read()) {
#endif
		solve();

#ifdef _DEBUG
	cerr << "TIME = " << clock() - tt << endl;
	tt = clock();
#endif

	}
}


/*
⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⡎⣿⢾⡿⣿⡆⢸⣽⢻⣄⠹⣷⣟⣿⣄⠹⣟⣿⣿⣟⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⢸⣯⣟⣧⠘⣷⠈⡯⠛⢀⡐⢾⣟⣷⣻⣿⣿⣿⡿⡌⢿⣻⣿⣿
⣿⣿⣿⣿⣿⣿⣧⢸⡿⣟⣿⡇⢸⣯⣟⣮⢧⡈⢿⣞⡿⣦⠘⠏⣹⣿⣽⢿⣿⣿⣿⣿⣯⣿⣿⣿⡇⢸⣿⣿⣾⡆⠹⢀⣠⣾⣟⣷⡈⢿⣞⣯⢿⣿⣿⣿⢷⠘⣯⣿⣿
⣿⣿⣿⣿⣿⣿⣿⡈⣿⢿⣽⡇⠘⠛⠛⠛⠓⠓⠈⠛⠛⠟⠇⢀⢿⣻⣿⣯⢿⣿⣿⣿⣷⢿⣿⣿⠁⣾⣿⣿⣿⣧⡄⠇⣹⣿⣾⣯⣿⡄⠻⣽⣯⢿⣻⣿⣿⡇⢹⣾⣿
⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⡽⡇⢸⣿⣿⣿⣿⣿⣞⣆⠰⣶⣶⡄⢀⢻⡿⣯⣿⡽⣿⣿⣿⢯⣟⡿⢀⣿⣿⣿⣿⣿⣧⠐⣸⣿⣿⣷⣿⣿⣆⠹⣯⣿⣻⣿⣿⣿⢀⣿⢿
⣿⣿⣿⣿⣿⣿⣿⣿⠘⣯⡿⡇⢸⣿⣿⣿⣿⣿⣿⣿⣧⡈⢿⣳⠘⡄⠻⣿⢾⣽⣟⡿⣿⢯⣿⡇⢸⣿⣿⣿⣿⣿⣿⡀⢾⣿⣿⣿⣿⣿⣿⣆⠹⣾⣷⣻⣿⡿⡇⢸⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⠇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠻⡇⢹⣆⠹⣟⣾⣽⣻⣟⣿⣽⠁⣾⣿⣿⣿⣿⣿⣿⣇⣿⣿⠿⠛⠛⠉⠙⠋⢀⠁⢘⣯⣿⣿⣧⠘⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⡈⣿⡃⢼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡙⠌⣿⣆⠘⣿⣞⡿⣞⡿⡞⢠⣿⣿⣿⣿⣿⡿⠛⠉⠁⢀⣀⣠⣤⣤⣶⣶⣶⡆⢻⣽⣞⡿⣷⠈⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠘⠁⠉⠉⠉⠉⠉⠉⠉⠉⠉⠙⠛⠛⢿⣄⢻⣿⣧⠘⢯⣟⡿⣽⠁⣾⣿⣿⣿⣿⣿⡃⢀⢀⠘⠛⠿⢿⣻⣟⣯⣽⣻⣵⡀⢿⣯⣟⣿⢀⣿
⣿⣿⣿⣟⣿⣿⣿⣿⣶⣶⡆⢀⣿⣾⣿⣾⣷⣿⣶⠿⠚⠉⢀⢀⣤⣿⣷⣿⣿⣷⡈⢿⣻⢃⣼⣿⣿⣿⣿⣻⣿⣿⣿⡶⣦⣤⣄⣀⡀⠉⠛⠛⠷⣯⣳⠈⣾⡽⣾⢀⣿
⣿⢿⣿⣿⣻⣿⣿⣿⣿⣿⡿⠐⣿⣿⣿⣿⠿⠋⠁⢀⢀⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣌⣥⣾⡿⣿⣿⣷⣿⣿⢿⣷⣿⣿⣟⣾⣽⣳⢯⣟⣶⣦⣤⡾⣟⣦⠘⣿⢾⡁⢺
⣿⣻⣿⣿⡷⣿⣿⣿⣿⣿⡗⣦⠸⡿⠋⠁⢀⢀⣠⣴⢿⣿⣽⣻⢽⣾⣟⣷⣿⣟⣿⣿⣿⣳⠿⣵⣧⣼⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣽⣳⣯⣿⣿⣿⣽⢀⢷⣻⠄⠘
⣿⢷⣻⣿⣿⣷⣻⣿⣿⣿⡷⠛⣁⢀⣀⣤⣶⣿⣛⡿⣿⣮⣽⡻⣿⣮⣽⣻⢯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⢀⢸⣿⢀⡆
⠸⣟⣯⣿⣿⣷⢿⣽⣿⣿⣷⣿⣷⣆⠹⣿⣶⣯⠿⣿⣶⣟⣻⢿⣷⣽⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢀⣯⣟⢀⡇
⣇⠹⣟⣾⣻⣿⣿⢾⡽⣿⣿⣿⣿⣿⣆⢹⣶⣿⣻⣷⣯⣟⣿⣿⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢀⡿⡇⢸⡇
⣿⣆⠹⣷⡻⣽⣿⣯⢿⣽⣻⣿⣿⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⢸⣿⠇⣼⡇
⡙⠾⣆⠹⣿⣦⠛⣿⢯⣷⢿⡽⣿⣿⣿⣿⣆⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠎⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⢀⣿⣾⣣⡿⡇
⣿⣷⡌⢦⠙⣿⣿⣌⠻⣽⢯⣿⣽⣻⣿⣿⣿⣧⠩⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⢰⢣⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⢀⢀⢿⣞⣷⢿⡇
⣿⣽⣆⠹⣧⠘⣿⣿⡷⣌⠙⢷⣯⡷⣟⣿⣿⣿⣷⡀⡹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣈⠃⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢀⣴⡧⢀⠸⣿⡽⣿⢀
⢻⣽⣿⡄⢻⣷⡈⢿⣿⣿⢧⢀⠙⢿⣻⡾⣽⣻⣿⣿⣄⠌⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢁⣰⣾⣟⡿⢀⡄⢿⣟⣿⢀
⡄⢿⣿⣷⢀⠹⣟⣆⠻⣿⣿⣆⢀⣀⠉⠻⣿⡽⣯⣿⣿⣷⣈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⢀⣠⠘⣯⣷⣿⡟⢀⢆⠸⣿⡟⢸
⣷⡈⢿⣿⣇⢱⡘⢿⣷⣬⣙⠿⣧⠘⣆⢀⠈⠻⣷⣟⣾⢿⣿⣆⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⣠⡞⢡⣿⢀⣿⣿⣿⠇⡄⢸⡄⢻⡇⣼
⣿⣷⡈⢿⣿⡆⢣⡀⠙⢾⣟⣿⣿⣷⡈⠂⠘⣦⡈⠿⣯⣿⢾⣿⣆⠙⠻⠿⠿⠿⠿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢋⣠⣾⡟⢠⣿⣿⢀⣿⣿⡟⢠⣿⢈⣧⠘⢠⣿
⣿⣿⣿⣄⠻⣿⡄⢳⡄⢆⡙⠾⣽⣿⣿⣆⡀⢹⡷⣄⠙⢿⣿⡾⣿⣆⢀⡀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣀⣠⣴⡿⣯⠏⣠⣿⣿⡏⢸⣿⡿⢁⣿⣿⢀⣿⠆⢸⣿
⣿⣿⣿⣿⣦⡙⣿⣆⢻⡌⢿⣶⢤⣉⣙⣿⣷⡀⠙⠽⠷⠄⠹⣿⣟⣿⣆⢙⣋⣤⣤⣤⣄⣀⢀⢀⢀⢀⣾⣿⣟⡷⣯⡿⢃⣼⣿⣿⣿⠇⣼⡟⣡⣿⣿⣿⢀⡿⢠⠈⣿
⣿⣿⣿⣿⣿⣷⣮⣿⣿⣿⡌⠁⢤⣤⣤⣤⣬⣭⣴⣶⣶⣶⣆⠈⢻⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣷⣶⣤⣌⣉⡘⠛⠻⠶⣿⣿⣿⣿⡟⣰⣫⣴⣿⣿⣿⣿⠄⣷⣿⣿⣿
*/

#include <bits/stdc++.h>

using namespace std;

//#define MULTITEST

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sqr(a) ((a) * (a))
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out << "(" << a.x << ", " << a.y << ")";
}

template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
	out << "[";
	forn(i, sz(v)) {
		if(i) out << ", ";
		out << v[i];
	}
	return out << "]";
}

mt19937 rnd(time(NULL));

const int INF = int(1e9);
const li INF64 = li(1e18);
const int MOD = int(1e9) + 7;
const ld EPS = 1e-9;
const ld PI = acos(-1.0);

const int N = 50 * 1000 + 13;

int n;
string s;

bool read () {
	static char buf[N];
	if (scanf("%s", buf) != 1)
		return false;
	s = buf;
	n = sz(s);
	return true;
}

// Don't forget to modify the string to avoid cyclic comparisons if needed

// lcp doesn't work with cyclic comparisons
// c_i - number of the distinct suffixes that are smaller than s[i..n]
// pos_i - i-th suffix in the sufarray is s[pos_i..n]

struct sparse_table {
	vector<vector<int>> st;
	vector<int> pw;

	sparse_table() {}

	sparse_table(const vector<int> &a) {
		int n = sz(a);
		int logn = 32 - __builtin_clz(n);
		st.resize(logn, vector<int>(n));
		forn(i, n)
			st[0][i] = a[i];
		fore(j, 1, logn) forn(i, n) {
			st[j][i] = st[j - 1][i];
			if (i + (1 << (j - 1)) < n)
				st[j][i] = min(st[j][i], st[j - 1][i + (1 << (j - 1))]);
		}
		pw.resize(n + 1);
		pw[0] = pw[1] = 0;
		fore(i, 2, n + 1)
			pw[i] = pw[i >> 1] + 1;
	}

	int get(int l, int r) {
		if (l >= r) return INF;
		int len = pw[r - l];
		return min(st[len][l], st[len][r - (1 << len)]);
	}
};

struct suffix_array {
	vector<int> c, pos;
	vector<pair<pt, int>> p, nw;
	vector<int> cnt;
	int n;

	void radix_sort(int max_al) {
		cnt.assign(max_al, 0);
		forn(i, n) ++cnt[p[i].x.y];
		fore(i, 1, max_al) cnt[i] += cnt[i - 1];
		nw.resize(n);
		forn(i, n) nw[--cnt[p[i].x.y]] = p[i];
		cnt.assign(max_al, 0);
		forn(i, n) ++cnt[nw[i].x.x];
		fore(i, 1, max_al) cnt[i] += cnt[i - 1];
		for (int i = n - 1; i >= 0; --i) p[--cnt[nw[i].x.x]] = nw[i];
	}

	vector<int> lcp;
	sparse_table st;

	int get_lcp(int l, int r) {
		l = c[l], r = c[r];
		if (l > r) swap(l, r);
		return st.get(l, r);
	}

	suffix_array(const string &s) {
		n = sz(s);
		c = vector<int>(all(s));
		int max_al = *max_element(all(c)) + 1;
		p.resize(n);
		for (int k = 1; k < n; k <<= 1) {
			for (int i = 0, j = k; i < n; ++i, j = (j + 1 == n ? 0 : j + 1))
				p[i] = mp(mp(c[i], c[j]), i);
			radix_sort(max_al);
			c[p[0].y] = 0;
			fore(i, 1, n) c[p[i].y] = c[p[i - 1].y] + (p[i].x != p[i - 1].x);
			max_al = c[p.back().y] + 1;
		}
		lcp.resize(n);
		int l = 0;
		forn(i, n) {
			l = max(0, l - 1);
			if (c[i] == n - 1)
				continue;
			while (i + l < n && p[c[i] + 1].y + l < n && s[i + l] == s[p[c[i] + 1].y + l])
				++l;
			lcp[c[i]] = l;
		}
		pos.resize(n);
		forn(i, n)
			pos[i] = p[i].y;
		st = sparse_table(lcp);
	}
};

void solve(){
	bool fl = false;
	suffix_array s1(s + " ");
	reverse(all(s));
	suffix_array s2(s + " ");
	reverse(all(s));
	fore(k, 1, sz(s) / 2 + 1){
		if (fl){
			s1 = suffix_array(s + " ");
			reverse(all(s));
			s2 = suffix_array(s + " ");
			reverse(all(s));
			fl = false;
		}
		vector<int> pos;
		int cnt = n / k;
		forn(i, cnt){
			int lensu = min(k, s2.get_lcp(n - (i * k), n - ((i + 1) * k)));
			int lenpr = min(k, s1.get_lcp(i * k, (i + 1) * k));
			if (lensu + lenpr >= k && lenpr > 0){
				if (pos.empty() || pos.back() + k <= i * k - lensu)
					pos.pb(i * k - lensu);
				else
					pos.pb(pos.back() + k);
			}
		}
		if (pos.empty())
			continue;
		string t = "";
		int j = 0;
		forn(i, n){
			if (j < sz(pos) && pos[j] == i){
				i += k - 1;
				++j;
				continue;
			}
			t += s[i];
		}
		s = t;
		n = sz(s);
		fl = true;
	}
	puts(s.c_str());
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int tt = clock();

#endif

	cerr.precision(15);
	cout.precision(15);
	cerr << fixed;
	cout << fixed;

#ifdef MULTITEST
	int tc;
	scanf("%d", &tc);
	while(tc--){
		read();
#else
	while(read()) {
#endif
		solve();

#ifdef _DEBUG
	cerr << "TIME = " << clock() - tt << endl;
	tt = clock();
#endif

	}
}


/*
⣿⣿⣿⣿⣿⣿⡷⣯⢿⣿⣷⣻⢯⣿⡽⣻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠸⣿⣿⣆⠹⣿⣿⢾⣟⣯⣿⣿⣿⣿⣿⣿⣽⣻⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣻⣽⡿⣿⣎⠙⣿⣞⣷⡌⢻⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⡄⠹⣿⣿⡆⠻⣿⣟⣯⡿⣽⡿⣿⣿⣿⣿⣽⡷⣯⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⡎⣿⢾⡿⣿⡆⢸⣽⢻⣄⠹⣷⣟⣿⣄⠹⣟⣿⣿⣟⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⢸⣯⣟⣧⠘⣷⠈⡯⠛⢀⡐⢾⣟⣷⣻⣿⣿⣿⡿⡌⢿⣻⣿⣿
⣿⣿⣿⣿⣿⣿⣧⢸⡿⣟⣿⡇⢸⣯⣟⣮⢧⡈⢿⣞⡿⣦⠘⠏⣹⣿⣽⢿⣿⣿⣿⣿⣯⣿⣿⣿⡇⢸⣿⣿⣾⡆⠹⢀⣠⣾⣟⣷⡈⢿⣞⣯⢿⣿⣿⣿⢷⠘⣯⣿⣿
⣿⣿⣿⣿⣿⣿⣿⡈⣿⢿⣽⡇⠘⠛⠛⠛⠓⠓⠈⠛⠛⠟⠇⢀⢿⣻⣿⣯⢿⣿⣿⣿⣷⢿⣿⣿⠁⣾⣿⣿⣿⣧⡄⠇⣹⣿⣾⣯⣿⡄⠻⣽⣯⢿⣻⣿⣿⡇⢹⣾⣿
⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⡽⡇⢸⣿⣿⣿⣿⣿⣞⣆⠰⣶⣶⡄⢀⢻⡿⣯⣿⡽⣿⣿⣿⢯⣟⡿⢀⣿⣿⣿⣿⣿⣧⠐⣸⣿⣿⣷⣿⣿⣆⠹⣯⣿⣻⣿⣿⣿⢀⣿⢿
⣿⣿⣿⣿⣿⣿⣿⣿⠘⣯⡿⡇⢸⣿⣿⣿⣿⣿⣿⣿⣧⡈⢿⣳⠘⡄⠻⣿⢾⣽⣟⡿⣿⢯⣿⡇⢸⣿⣿⣿⣿⣿⣿⡀⢾⣿⣿⣿⣿⣿⣿⣆⠹⣾⣷⣻⣿⡿⡇⢸⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⠇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠻⡇⢹⣆⠹⣟⣾⣽⣻⣟⣿⣽⠁⣾⣿⣿⣿⣿⣿⣿⣇⣿⣿⠿⠛⠛⠉⠙⠋⢀⠁⢘⣯⣿⣿⣧⠘⣿
⣿⣿⣿⣿⣿⣿⣿⣿⣿⡈⣿⡃⢼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡙⠌⣿⣆⠘⣿⣞⡿⣞⡿⡞⢠⣿⣿⣿⣿⣿⡿⠛⠉⠁⢀⣀⣠⣤⣤⣶⣶⣶⡆⢻⣽⣞⡿⣷⠈⣿
⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠘⠁⠉⠉⠉⠉⠉⠉⠉⠉⠉⠙⠛⠛⢿⣄⢻⣿⣧⠘⢯⣟⡿⣽⠁⣾⣿⣿⣿⣿⣿⡃⢀⢀⠘⠛⠿⢿⣻⣟⣯⣽⣻⣵⡀⢿⣯⣟⣿⢀⣿
⣿⣿⣿⣟⣿⣿⣿⣿⣶⣶⡆⢀⣿⣾⣿⣾⣷⣿⣶⠿⠚⠉⢀⢀⣤⣿⣷⣿⣿⣷⡈⢿⣻⢃⣼⣿⣿⣿⣿⣻⣿⣿⣿⡶⣦⣤⣄⣀⡀⠉⠛⠛⠷⣯⣳⠈⣾⡽⣾⢀⣿
⣿⢿⣿⣿⣻⣿⣿⣿⣿⣿⡿⠐⣿⣿⣿⣿⠿⠋⠁⢀⢀⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣌⣥⣾⡿⣿⣿⣷⣿⣿⢿⣷⣿⣿⣟⣾⣽⣳⢯⣟⣶⣦⣤⡾⣟⣦⠘⣿⢾⡁⢺
⣿⣻⣿⣿⡷⣿⣿⣿⣿⣿⡗⣦⠸⡿⠋⠁⢀⢀⣠⣴⢿⣿⣽⣻⢽⣾⣟⣷⣿⣟⣿⣿⣿⣳⠿⣵⣧⣼⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣽⣳⣯⣿⣿⣿⣽⢀⢷⣻⠄⠘
⣿⢷⣻⣿⣿⣷⣻⣿⣿⣿⡷⠛⣁⢀⣀⣤⣶⣿⣛⡿⣿⣮⣽⡻⣿⣮⣽⣻⢯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⢀⢸⣿⢀⡆
⠸⣟⣯⣿⣿⣷⢿⣽⣿⣿⣷⣿⣷⣆⠹⣿⣶⣯⠿⣿⣶⣟⣻⢿⣷⣽⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢀⣯⣟⢀⡇
⣇⠹⣟⣾⣻⣿⣿⢾⡽⣿⣿⣿⣿⣿⣆⢹⣶⣿⣻⣷⣯⣟⣿⣿⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢀⡿⡇⢸⡇
⣿⣆⠹⣷⡻⣽⣿⣯⢿⣽⣻⣿⣿⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⢸⣿⠇⣼⡇
⡙⠾⣆⠹⣿⣦⠛⣿⢯⣷⢿⡽⣿⣿⣿⣿⣆⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠎⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⢀⣿⣾⣣⡿⡇
⣿⣷⡌⢦⠙⣿⣿⣌⠻⣽⢯⣿⣽⣻⣿⣿⣿⣧⠩⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⢰⢣⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⢀⢀⢿⣞⣷⢿⡇
⣿⣽⣆⠹⣧⠘⣿⣿⡷⣌⠙⢷⣯⡷⣟⣿⣿⣿⣷⡀⡹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣈⠃⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢀⣴⡧⢀⠸⣿⡽⣿⢀
⢻⣽⣿⡄⢻⣷⡈⢿⣿⣿⢧⢀⠙⢿⣻⡾⣽⣻⣿⣿⣄⠌⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢁⣰⣾⣟⡿⢀⡄⢿⣟⣿⢀
⡄⢿⣿⣷⢀⠹⣟⣆⠻⣿⣿⣆⢀⣀⠉⠻⣿⡽⣯⣿⣿⣷⣈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⢀⣠⠘⣯⣷⣿⡟⢀⢆⠸⣿⡟⢸
⣷⡈⢿⣿⣇⢱⡘⢿⣷⣬⣙⠿⣧⠘⣆⢀⠈⠻⣷⣟⣾⢿⣿⣆⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⣠⡞⢡⣿⢀⣿⣿⣿⠇⡄⢸⡄⢻⡇⣼
⣿⣷⡈⢿⣿⡆⢣⡀⠙⢾⣟⣿⣿⣷⡈⠂⠘⣦⡈⠿⣯⣿⢾⣿⣆⠙⠻⠿⠿⠿⠿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢋⣠⣾⡟⢠⣿⣿⢀⣿⣿⡟⢠⣿⢈⣧⠘⢠⣿
⣿⣿⣿⣄⠻⣿⡄⢳⡄⢆⡙⠾⣽⣿⣿⣆⡀⢹⡷⣄⠙⢿⣿⡾⣿⣆⢀⡀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣀⣠⣴⡿⣯⠏⣠⣿⣿⡏⢸⣿⡿⢁⣿⣿⢀⣿⠆⢸⣿
⣿⣿⣿⣿⣦⡙⣿⣆⢻⡌⢿⣶⢤⣉⣙⣿⣷⡀⠙⠽⠷⠄⠹⣿⣟⣿⣆⢙⣋⣤⣤⣤⣄⣀⢀⢀⢀⢀⣾⣿⣟⡷⣯⡿⢃⣼⣿⣿⣿⠇⣼⡟⣡⣿⣿⣿⢀⡿⢠⠈⣿
⣿⣿⣿⣿⣿⣷⣮⣿⣿⣿⡌⠁⢤⣤⣤⣤⣬⣭⣴⣶⣶⣶⣆⠈⢻⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣷⣶⣤⣌⣉⡘⠛⠻⠶⣿⣿⣿⣿⡟⣰⣫⣴⣿⣿⣿⣿⠄⣷⣿⣿⣿
*/

#include <bits/stdc++.h>

using namespace std;

//#define MULTITEST

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sqr(a) ((a) * (a))
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out << "(" << a.x << ", " << a.y << ")";
}

template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
	out << "[";
	forn(i, sz(v)) {
		if(i) out << ", ";
		out << v[i];
	}
	return out << "]";
}

mt19937 rnd(time(NULL));

const int INF = int(1e9);
const li INF64 = li(1e18);
const int MOD = int(1e9) + 7;
const ld EPS = 1e-9;
const ld PI = acos(-1.0);

const int N = 50 * 1000 + 13;

int n;
string s;

bool read () {
	static char buf[N];
	if (scanf("%s", buf) != 1)
		return false;
	s = buf;
	n = sz(s);
	return true;
}

// Don't forget to modify the string to avoid cyclic comparisons if needed

// lcp doesn't work with cyclic comparisons
// c_i - number of the distinct suffixes that are smaller than s[i..n]
// pos_i - i-th suffix in the sufarray is s[pos_i..n]

struct suffix_array {
	vector<int> c, pos;
	vector<pair<pt, int>> p, nw;
	vector<int> cnt;
	int n;

	void radix_sort(int max_al) {
		cnt.assign(max_al, 0);
		forn(i, n) ++cnt[p[i].x.y];
		fore(i, 1, max_al) cnt[i] += cnt[i - 1];
		nw.resize(n);
		forn(i, n) nw[--cnt[p[i].x.y]] = p[i];
		cnt.assign(max_al, 0);
		forn(i, n) ++cnt[nw[i].x.x];
		fore(i, 1, max_al) cnt[i] += cnt[i - 1];
		for (int i = n - 1; i >= 0; --i) p[--cnt[nw[i].x.x]] = nw[i];
	}

	vector<int> lcp;
	vector<vector<int>> st;
	vector<int> pw;

	void build() {
		int logn = 32 - __builtin_clz(n);
		st.resize(logn, vector<int>(n));
		forn(i, n)
			st[0][i] = lcp[i];
		fore(j, 1, logn) forn(i, n) {
			st[j][i] = st[j - 1][i];
			if (i + (1 << (j - 1)) < n)
				st[j][i] = min(st[j][i], st[j - 1][i + (1 << (j - 1))]);
		}
		pw.resize(n + 1);
		pw[0] = pw[1] = 0;
		fore(i, 2, n + 1)
			pw[i] = pw[i / 2] + 1;
	}

	int get_lcp(int l, int r) {
		l = c[l], r = c[r];
		if (l > r) swap(l, r);
		if (l == r) return INF;
		int len = pw[r - l];
		return min(st[len][l], st[len][r - (1 << len)]);
	}

	suffix_array(const string &s) {
		n = sz(s);
		c = vector<int>(all(s));
		int max_al = *max_element(all(c)) + 1;
		p.resize(n);
		for (int k = 1; k < n; k <<= 1) {
			for (int i = 0, j = k; i < n; ++i, j = (j + 1 == n ? 0 : j + 1))
				p[i] = mp(mp(c[i], c[j]), i);
			radix_sort(max_al);
			c[p[0].y] = 0;
			fore(i, 1, n) c[p[i].y] = c[p[i - 1].y] + (p[i].x != p[i - 1].x);
			max_al = c[p.back().y] + 1;
		}
		lcp.resize(n);
		int l = 0;
		forn(i, n) {
			l = max(0, l - 1);
			if (c[i] == n - 1)
				continue;
			while (i + l < n && p[c[i] + 1].y + l < n && s[i + l] == s[p[c[i] + 1].y + l])
				++l;
			lcp[c[i]] = l;
		}
		pos.resize(n);
		forn(i, n)
			pos[i] = p[i].y;
		build();
	}
};

void solve(){
	fore(k, 1, sz(s) / 2 + 1){
		suffix_array s1(s + " ");
		reverse(all(s));
		suffix_array s2(s + " ");
		reverse(all(s));
		vector<int> pos;
		int cnt = n / k;
		forn(i, cnt){
			int lensu = min(k, s2.get_lcp(n - (i * k), n - ((i + 1) * k)));
			int lenpr = min(k, s1.get_lcp(i * k, (i + 1) * k));
			if (lensu + lenpr >= k && lenpr > 0){
				if (pos.empty() || pos.back() + k <= i * k - lensu)
					pos.pb(i * k - lensu);
				else
					pos.pb(pos.back() + k);
			}
		}
		if (pos.empty()) continue;
		string t = "";
		int j = 0;
		forn(i, n){
			if (j < sz(pos) && pos[j] == i){
				i += k - 1;
				++j;
				continue;
			}
			t += s[i];
		}
		s = t;
		n = sz(s);
	}
	puts(s.c_str());
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int tt = clock();

#endif

	cerr.precision(15);
	cout.precision(15);
	cerr << fixed;
	cout << fixed;

#ifdef MULTITEST
	int tc;
	scanf("%d", &tc);
	while(tc--){
		read();
#else
	while(read()) {
#endif
		solve();

#ifdef _DEBUG
	cerr << "TIME = " << clock() - tt << endl;
	tt = clock();
#endif

	}
}


#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define all(a) a.begin(),a.end()
#define ull unsigned long long
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define iter multiset< int >::iterator
#define iter1 vector<int>::iterator
using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

template<class T>
using ordered_multiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rnd1(chrono::steady_clock::now().time_since_epoch().count());

//find_by_order
//order_of_key

const int N=1e5+7;
const int inf=1e18+1e9;
const int mod=1e9+7;
const ld eps=1e-9;

//const int MAX_MEM=1e8;
//int mpos=0;
//char mem[MAX_MEM];
//
//inline void * operator new(size_t n){
//    char *res=mem+mpos;
//    mpos+=n;
//    assert(mpos<=MAX_MEM);
//    return (void*)res;
//}
//
//inline void operator delete(void *) {}

main ()
{
    ios;
    string s;
    cin>>s;
    int n=s.size();
    for (int len=1;len*2<=n;++len){
        int cur=0;
        for (int i=0;i+len<n;++i){
            if (s[i]==s[i+len]){
                ++cur;
            }
            else {
                cur=0;
            }
            if (cur==len){
                for (int j=i+1;j+len<n;++j){
                    s[j]=s[j+len];
                }
                n-=len;
                --len;
                break;
            }
        }
    }
    for (int i=0;i<n;++i){
        cout<<s[i];
    }
}

//1 10
//2 1 4 3 4 3 6 10 2 1


#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define all(a) a.begin(),a.end()
#define ull unsigned long long
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define iter multiset< int >::iterator
#define iter1 vector<int>::iterator
using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

template<class T>
using ordered_multiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rnd1(chrono::steady_clock::now().time_since_epoch().count());

//find_by_order
//order_of_key

const int N=1e5+7;
const int inf=1e18+1e9;
const int mod=1e9+7;
const ld eps=1e-9;

//const int MAX_MEM=1e8;
//int mpos=0;
//char mem[MAX_MEM];
//
//inline void * operator new(size_t n){
//    char *res=mem+mpos;
//    mpos+=n;
//    assert(mpos<=MAX_MEM);
//    return (void*)res;
//}
//
//inline void operator delete(void *) {}

main ()
{
    ios;
    string s;
    cin>>s;
    int n=s.size();
    for (int len=1;len*2<=n;++len){
        int cur=0;
        for (int i=0;i+len<n;++i){
            if (s[i]==s[i+len]){
                ++cur;
            }
            else {
                cur=0;
            }
            if (cur==len){
                for (int j=i+1;j+len<n;++j){
                    s[j]=s[j+len];
                }
                n-=len;
                len=0;
                break;
            }
        }
    }
    for (int i=0;i<n;++i){
        cout<<s[i];
    }
}

//1 10
//2 1 4 3 4 3 6 10 2 1


#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define all(a) a.begin(),a.end()
#define ull unsigned long long
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define iter multiset< int >::iterator
#define iter1 vector<int>::iterator
#define int long long
using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

template<class T>
using ordered_multiset=tree<T,null_type,less_equal<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rnd1(chrono::steady_clock::now().time_since_epoch().count());

//find_by_order
//order_of_key

const int N=1e5+7;
const int inf=1e18+1e9;
const int mod=1e9+7;
const ld eps=1e-9;

//const int MAX_MEM=1e8;
//int mpos=0;
//char mem[MAX_MEM];
//
//inline void * operator new(size_t n){
//    char *res=mem+mpos;
//    mpos+=n;
//    assert(mpos<=MAX_MEM);
//    return (void*)res;
//}
//
//inline void operator delete(void *) {}

main ()
{
    ios;
    string s;
    cin>>s;
    int n=s.size();
    for (int len=1;len*2<=n;++len){
        int cur=0;
        for (int i=0;i+len<n;++i){
            if (s[i]==s[i+len]){
                ++cur;
            }
            else {
                cur=0;
            }
            if (cur==len){
                for (int j=i+1;j+len<n;++j){
                    s[j]=s[j+len];
                }
                n-=len;
                --len;
                break;
            }
        }
    }
    for (int i=0;i<n;++i){
        cout<<s[i];
    }
}

//1 10
//2 1 4 3 4 3 6 10 2 1


#include <iostream>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#define MAXN 600000+100
using namespace std;
struct Edge{
    int u,v,w,next;
} E[MAXN*2];
int n,m,ss,tt;
int edge_cnt=0;
int head[MAXN];
int dfn[MAXN],low[MAXN];
bool instack[MAXN];
int block[MAXN];
int clock=0;
vector<pair<int,int> > tree[MAXN];
queue<int> q;
int val[MAXN];
void addedge(int u,int v,int w) {
    E[edge_cnt].u=u;
    E[edge_cnt].v=v;
    E[edge_cnt].w=w;
    E[edge_cnt].next=head[u];
    head[u]=edge_cnt++;
}
stack<int> sta;
int block_cnt=0;
void tarjan(int u,int fa) {
    //cout<<"u:"<<u<<endl;
    dfn[u]=low[u]=++clock;
    instack[u]=true;
    sta.push(u);
    int flag=0;
    for(int i=head[u]; i!=-1; i=E[i].next) {
        int v=E[i].v;
        if(v==fa&&!flag) {
            flag=1;
            continue;
        }
        if(dfn[v]==0) {
            tarjan(v,u);
            low[u]=min(low[u],low[v]);
        } else if( instack[v]==true ) {
            low[u]=min(low[u],dfn[v]);
        }
    }
    if(low[u]==dfn[u]) {
        block_cnt++;
        while(1) {
            int now=sta.top();
            sta.pop();
            instack[now]=false;
            block[now]=block_cnt;
            if(now==u) break;
        }
    }
}
void buildtree() {
    for(int i=0; i<2*m; i++) {
        int u=E[i].u,v=E[i].v,w=E[i].w;
            //cout<<"u v w:"<<u<<" "<<v<<" "<<w<<endl;
            //cout<<"bu bv:"<<block[u]<<" "<<block[v]<<endl;
        if( block[ u ]!=block[ v ] ) {
            u=block[u]; v=block[v];
            tree[u].push_back(make_pair(v,w));
            tree[v].push_back(make_pair(u,w));
        }else{
            if(E[i].w==1){
                val[ block[u] ]=1;
            }
        }
    }
}
int dis[MAXN];
int vis[MAXN];
int bfs(int ss,int tt){
    //cout<<"ss tt:"<<ss<<" "<<tt<<endl;
    memset(dis,0,sizeof(dis));
    memset(vis,0,sizeof(vis));
    q.push(ss);
    dis[ss]=val[ss];
    vis[ss]=1;
    while(q.size()){
        int now=q.front();
        q.pop();
        for(int i=0;i<tree[now].size();i++){
            int v=tree[now][i].first;
            if(vis[v]==1) continue;
            q.push(v);
            vis[v]=true;
            if(dis[v]<dis[now]+tree[now][i].second+val[v]){
                dis[v]=dis[now]+tree[now][i].second+val[v];
            }
            if(v==tt) break;
        }
    }
    return dis[ tt ];
}
int main() {
    scanf("%d%d",&n,&m);
    memset(head,-1,sizeof(head));
    for(int i=0; i<m; i++) {
        int u,v,w;
        scanf("%d%d%d",&u,&v,&w);
        addedge(u,v,w);
        addedge(v,u,w);
    }
    scanf("%d%d",&ss,&tt);
    memset(dfn,0,sizeof(dfn));
    memset(low,0,sizeof(low));
    memset(instack,false,sizeof(instack));
    for(int i=1; i<=n; i++) {
        if(dfn[i]==0) {
            tarjan(i,-1);
        }
    }
    buildtree();
    if(bfs(block[ss],block[tt])>=1) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n,m;
struct edge{
    int u,v,nxt,t;
}edges[600008];
int nedge;
int head[300008];
int dfn[300008],low[300008];
int dp[300008];
int cnt;
bool ans;
int a,b;
void add_edge(int u,int v,int t){
    edges[nedge].u=u;
    edges[nedge].v=v;
    edges[nedge].t=t;
    edges[nedge].nxt=head[u];
    head[u]=nedge++;
}

void tarjan(int u,int fa){
    dfn[u]=low[u]=++cnt;
    if(u==b)
        dp[u]|=2;
    for(int i=head[u];i!=-1;i=edges[i].nxt){
        int v=edges[i].v;
//    cout<<u<<" "<<v<<endl;
        int t=edges[i].t;
        if(v==fa) continue ;
        if(dfn[v]!=-1){
            low[u]=min(low[u],dfn[v]);
            dp[u]|=dp[v];
            dp[u]|=t;
        }
        else{
            tarjan(v,u);
            if(ans) return;
            if(dfn[u]>=low[v]){
                low[u]=min(low[u],low[v]);
                dp[u]|=t;
                dp[u]|=dp[v];
            }
            if(dp[v]>=2){
                dp[u]|=2;
            }
            if(t&&dp[v]>=2){
                dp[u]=3;
            }
        }
    }
    if(dp[u]==3){
        ans=1;
        return ;
    }
}

int main(){
    scanf("%d %d",&n,&m);
    memset(head,-1,sizeof head);
    memset(dfn,-1,sizeof dfn);
    memset(low,-1,sizeof low);
    memset(dp,0,sizeof dp);
    cnt=0;
    nedge=0;
    ans=0;
    int u,v,t;
    for(int i=1;i<=m;i++){
        scanf("%d %d %d",&u,&v,&t);
        add_edge(u,v,t);
        add_edge(v,u,t);
    }
    scanf("%d %d",&a,&b);
    tarjan(a,-1);
    if(ans) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}


#include <stdio.h>
#include <string.h>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
const int N=300000+5;
const int M=300000+5;
struct EDGE
{
    int v, next, c;
}edge[M << 1];
int first[N], low[N], dfn[N], belong[N], sta[M], instack[M], num[N];
int g,cnt,top,scc;
int min(int a,int b)
{
    return a<b?a:b;
}
void AddEdge(int u,int v, int c)
{
    edge[g].v = v;
    edge[g].c = c;
    edge[g].next = first[u];
    first[u] = g++;
}
void Tarjan(int u,int fa)
{
    int v;
    low[u] = dfn[u] = ++cnt;
    sta[++top] = u;
    instack[u] = 1;
    for(int i = first[u]; i != -1; i = edge[i].next)
    {
        v = edge[i].v;
        if(i == (fa^1))
            continue;
        if(!dfn[v])
        {
            Tarjan(v,i);
            low[u] = min(low[u],low[v]);
        }
        else if(instack[v])
            low[u] = min(low[u],dfn[v]);
    }
    if(dfn[u] == low[u])
    {
        scc++;
        while(1)
        {
            v=sta[top--];
            instack[v] = 0;
            belong[v] = scc;
            if(v == u)
                break;
        }
    }
}
int vis[N];
vector <pair<int, int> >G[N];
int Bfs(int be, int en)
{
    queue<pair<int, int> > Q;
    while(!Q.empty()) Q.pop();
    memset(vis, 0, sizeof(vis));
    Q.push(make_pair(be, num[be]));
    vis[be] = 1;
    while(!Q.empty())
    {
        pair<int, int> now = Q.front();
        Q.pop();
        if(now.first == en) return now.second;
        int siz = G[now.first].size();
        for(int i = 0; i < siz; i++)
        {
            int next = G[now.first][i].first;
            if(vis[next]) continue;
            vis[next] = 1;
            Q.push(make_pair(next, now.second + num[next] + G[now.first][i].second));
        }
    }
}

int main()
{
    int n, m, target = 0, be, en;
    scanf("%d%d",&n,&m);
    g = cnt = top = scc = 0;
    memset(first, -1, sizeof(first));
    memset(low, 0, sizeof(low));
    memset(dfn, 0, sizeof(dfn));
    memset(num, 0, sizeof(num));
    memset(instack, 0, sizeof(instack));
    for(int u, v, c, i = 0; i < m; i++)
    {
        scanf("%d%d%d",&u,&v,&c);
        AddEdge(u, v, c);
        AddEdge(v, u, c);
        target += c;
    }
    for(int i = 1; i <= n; i++)
        if(!dfn[i])
            Tarjan(1,-1);
    for(int i = 1; i <= n; i++)
    {
        for(int j = first[i]; j != -1; j=edge[j].next)
        {
            int v = edge[j].v;
            if(belong[i] != belong[v])
            {
                G[belong[i]].push_back(make_pair(belong[v], edge[j].c));
            }
            else
                num[belong[i]] += edge[j].c;
        }
    }
    for(int i = 1; i <= scc; i++) num[i] /= 2;
    scanf("%d%d", &be, &en);
    if(Bfs(belong[be], belong[en]) == target) puts("YES");
    else
        puts("NO");
}


#include <stdio.h>
#include <string.h>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
const int N=300000+5;
const int M=300000+5;
struct EDGE
{
    int v, next, c;
}edge[M << 1];
int first[N], low[N], dfn[N], belong[N], sta[M], instack[M], num[N];
int g,cnt,top,scc;
int min(int a,int b)
{
    return a<b?a:b;
}
void AddEdge(int u,int v, int c)
{
    edge[g].v = v;
    edge[g].c = c;
    edge[g].next = first[u];
    first[u] = g++;
}
void Tarjan(int u,int fa)
{
    int v;
    low[u] = dfn[u] = ++cnt;
    sta[++top] = u;
    instack[u] = 1;
    for(int i = first[u]; i != -1; i = edge[i].next)
    {
        v = edge[i].v;
        if(i == (fa^1))
            continue;
        if(!dfn[v])
        {
            Tarjan(v,i);
            low[u] = min(low[u],low[v]);
        }
        else if(instack[v])
            low[u] = min(low[u],dfn[v]);
    }
    if(dfn[u] == low[u])
    {
        scc++;
        while(1)
        {
            v=sta[top--];
            instack[v] = 0;
            belong[v] = scc;
            if(v == u)
                break;
        }
    }
}
int vis[N];
vector <pair<int, int> >G[N];
int Bfs(int be, int en)
{
    queue<pair<int, int> > Q;
    while(!Q.empty()) Q.pop();
    memset(vis, 0, sizeof(vis));
    Q.push(make_pair(be, num[be]));
    vis[be] = 1;
    while(!Q.empty())
    {
        pair<int, int> now = Q.front();
        Q.pop();
        if(now.first == en) return now.second;
        int siz = G[now.first].size();
        for(int i = 0; i < siz; i++)
        {
            int next = G[now.first][i].first;
            if(vis[next]) continue;
            vis[next] = 1;
            Q.push(make_pair(next, now.second + num[next] + G[now.first][i].second));
        }
    }
}

int main()
{
    int n, m, target = 0, be, en;
    scanf("%d%d",&n,&m);
    g = cnt = top = scc = 0;
    memset(first, -1, sizeof(first));
    memset(low, 0, sizeof(low));
    memset(dfn, 0, sizeof(dfn));
    memset(num, 0, sizeof(num));
    memset(instack, 0, sizeof(instack));
    for(int u, v, c, i = 0; i < m; i++)
    {
        scanf("%d%d%d",&u,&v,&c);
        AddEdge(u, v, c);
        AddEdge(v, u, c);
        target += c;
    }
    for(int i = 1; i <= n; i++)
        if(!dfn[i])
            Tarjan(1,-1);
    for(int i = 1; i <= n; i++)
    {
        for(int j = first[i]; j != -1; j=edge[j].next)
        {
            int v = edge[j].v;
            if(belong[i] != belong[v])
            {
                G[belong[i]].push_back(make_pair(belong[v], edge[j].c));
            }
            else
                num[belong[i]] += edge[j].c;
        }
    }
    for(int i = 1; i <= scc; i++) num[i] /= 2;
    scanf("%d%d", &be, &en);
    cout << scc << endl;
    if(Bfs(belong[be], belong[en])) puts("YES");
    else
        puts("NO");
}
/*
12 11
1 10 0
5 10 0
8 10 0
6 5 0
9 10 1
3 6 1
12 6 0
4 8 0
7 9 1
2 4 1
11 9 1
7 2
*/