#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<iostream>
#include<string>
#include<deque>
#include<list>
#include<queue>
#include<vector>
#include<algorithm>
#include<map>
#include<stack>
#include<set>
using namespace std;
#define ll long long
#define lowbit(x) (x&-x)
#define f first
#define s second
#define pr pair<int,int>
#define mk(x,y) make_pair(x,y)
#define eps 1e-8
#define pi acos(-1.0)
#define square(x) ((x)*(x))
#define getvec(x,y) ((y)-(x))
#define xmul(x1,y1,x2,y2) ((x1)*(y2)-(x2)*(y1))
#define inf 0x3f3f3f3f
#define mod ((ll)1e9+7)
#define maxn 100010

int n,m,c,a[maxn],b[maxn];
int lef[maxn],rig[maxn];
int main()
{
#ifndef ONLINE_JUDGE
	freopen("G:\\ACM\\inandout\\in.txt","r",stdin);
//	freopen("G:\\ACM\\inandout\\out.txt","w",stdout);
#endif
    scanf("%d%d%d",&n,&m,&c);
    for(int i=1;i<=n;i++) scanf("%d",a+i);
    for(int i=1;i<=m;i++) scanf("%d",b+i);
    for(int i=1;i<=m;i++) lef[i]=(lef[i-1]+b[i])%c;
    for(int i=m;i>0;i--) rig[i]=(rig[i+1]+b[i])%c;
    int i=1;
    for(;i*m<=n-m+1;i++) {
        for(int j=(i-1)*m+1;j<=i*m;j++) a[j]=(a[j]+lef[j-(i-1)*m])%c;
        for(int j=(i+1)*m-1;j>i*m;j--)
            if(j<=n) a[j]=(a[j]+rig[j-i*m+1])%c;
    }
    for(int j=(i-1)*m+1;j<=n-m+1;j++) a[j]=(a[j]+lef[j-(i-1)*m])%c;
    if((i-1)*m<=n-m)
        for(int j=n;j>n-m+1;j--) a[j]=(a[j]+rig[j-(n-m)])%c;
    for(i=1;i<=n;i++) printf("%d ",a[i]);
    printf("\n");
	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<cmath>
 using namespace std;
 int main(){
    int n,m,c,i,j;
    int a[100001],b[100001],t[100001];

    while(scanf("%d%d%d",&n,&m,&c)==3){
        for(i=0;i<n;i++){
                scanf("%d",&a[i]);
                t[i]=a[i];
        }

        for(i=0;i<m;i++)
            scanf("%d",&b[i]);
        int k=0,step;

        for(step=1;step<=n-m+1;step++){

            i=step-1;

            for(j=0;j<m;j++){

                int v=b[j]+t[i];

                v=v%c;
                t[i]=v;
                i++;

            }

        }

        for(i=0;i<n;i++)
          if(i+1!=n)
              printf("%d ",t[i]);
         else printf("%d\n",t[i]);
    }
    return 0;
 }


#include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<cmath>
 using namespace std;
 int main(){
    int n,m,c,i,j;
    int a[100001],b[100001],t[10001];

    while(scanf("%d%d%d",&n,&m,&c)==3){
        for(i=0;i<n;i++){
                scanf("%d",&a[i]);
                t[i]=a[i];
        }

        for(i=0;i<m;i++)
            scanf("%d",&b[i]);
        int k=0,step;

        for(step=1;step<=n-m+1;step++){

            i=step-1;
            for(j=0;j<m;j++){
                int v=b[j]+t[i];
                v=v%c;
                t[i]=v;
                i++;
            }

        }

        for(i=0;i<n;i++)
          if(i+1!=n)
              printf("%d ",t[i]);
         else printf("%d\n",t[i]);
    }
    return 0;
 }


#include<iostream>
#include<cstdio>
#include<string>
#include<sstream>
#include<cstring>
#include<vector>
#include<map>
#include<cctype>
 using namespace std;

 int main()
 {
     int i,j,n,m,c;
     int a[100004],b[100004];

     while(cin>>n>>m>>c)
     {
         for(i=1;i<=n;i++)cin>>a[i];
         for(i=1;i<=m;i++)cin>>b[i];

         for(i=1;i<=m;i++)
         {
             for(j=i;j<=n-m+i;j++)
                a[j]=b[i]+a[j];

         }

         for(i=1;i<=n;i++)
            a[i]=a[i]%c;
         for(i=1;i<=n-1;i++)
            cout<<a[i]<<" ";
         cout<<a[n]<<endl;
     }

     return 0;
 }


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ProblemA {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line = reader.readLine();

        while (true) {
            String newLine = clean(line);
            if (newLine.length() == line.length()) {
                System.out.println(newLine);
                break;
            }
            line = newLine;
        }
    }

    private static String clean(String line) {
        StringBuffer t = new StringBuffer();
        char pc = 0;
        int state = 0;
        for (char c : line.toCharArray()) {
            if (state == 0) {
                pc = c;
                state = 1;
            } else {
                if (pc != c) {
                    if (t.length() > 0 && t.charAt(t.length()-1) == pc) {
                        t.deleteCharAt(t.length()-1);
                    }
                    else
                        t.append(pc);
                    pc = c;
                } else {
                    state = 0;
                }
            }
        }
        if (state == 1)
            t.append(pc);
        return t.toString();
    }

}


import java.util.*;
import java.io.*;

public class Solution {
public StringBuilder plug(StringBuilder input){
	int len = input.length();
	int prev_len = 0;
	//if(len == 0)
		//return "";
	while(prev_len - len != 0){
		StringBuilder s = new StringBuilder();
		int i = 0;
		while(i < len){
			if(i+1 < len && input.charAt(i) == input.charAt(i+1) ){
				i = i + 2;

			}
			else if (i < len){
				s.append(input.charAt(i));
				++i;
			}

		}
		input = s;
		prev_len = len;
		len = input.length();
	}
	return input;

}

public static void main(String[] args) throws IOException{

    	BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    	Solution a = new Solution();

    	String s = reader.readLine();
    	StringBuilder input = new StringBuilder(s);
    	StringBuilder result = a.plug(input);
    	System.out.println(result.toString());

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;

public class ProblemA {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line = reader.readLine();
        String newLine = clean2(line);
        System.out.println(newLine);

//        while (true) {
//            String newLine = clean2(line);
//            if (newLine.length() == line.length()) {
//                System.out.println(newLine);
//                break;
//            }
//            line = newLine;
//        }
    }

    private static String clean2(String line) {
        Stack<Character> s = new Stack<Character>();
        for(char c : line.toCharArray()) {
            if (! s.isEmpty() && s.peek() == c)
                s.pop();
            else
                s.push(c);
        }
        StringBuffer b = new StringBuffer();
        while (!s.isEmpty()) {
            b.insert(0, s.pop());
        }
        return b.toString();
    }

    private static String clean(String line) {
        StringBuffer t = new StringBuffer();
        char pc = 0;
        int state = 0;
        for (char c : line.toCharArray()) {
            if (state == 0) {
                pc = c;
                state = 1;
            } else {
                if (pc != c) {
                    if (t.length() > 0 && t.charAt(t.length()-1) == pc) {
                        t.deleteCharAt(t.length()-1);
                    }
                    else
                        t.append(pc);
                    pc = c;
                } else {
                    state = 0;
                }
            }
        }
        if (state == 1)
            t.append(pc);
        return t.toString();
    }

}


import java.util.Scanner;

public class ProblemA {
    public static void main(String[] args) {

        Scanner reader = new Scanner(System.in);
        String line = reader.next();

        while (true) {
            String newLine = clean(line);
            if (newLine.length() == line.length()) {
                System.out.println(newLine);
                break;
            }
            line = newLine;
        }
    }

    private static String clean(String line) {
        StringBuffer t = new StringBuffer();
        char pc = line.charAt(0);
        int state = 0;
        for(int i=1;i<line.length(); i++) {
             char c = line.charAt(i);
            if (pc != c) {
                if (state == 0) {
                    t.append(pc);
                }
                state = 0;
                pc = c;
            }
            else {
                state = 1;
            }
        }
        if (state == 0)
            t.append(pc);
        return t.toString();
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ProblemA {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line = reader.readLine();

        while (true) {
            String newLine = clean(line);
            if (newLine.length() == line.length()) {
                System.out.println(newLine);
                break;
            }
            line = newLine;
        }
    }

    private static String clean(String line) {
        StringBuffer t = new StringBuffer();
        char pc = 0;
        int state = 0;
        for (char c : line.toCharArray()) {
            if (state == 0) {
                pc = c;
                state = 1;
            } else {
                if (pc != c) {
                    t.append(pc);
                    pc = c;
                } else {
                    state = 0;
                }
            }
        }
        if (state == 1)
            t.append(pc);
        return t.toString();
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;

public class ProblemA {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line = reader.readLine();

        while (true) {
            String newLine = clean2(line);
            if (newLine.length() == line.length()) {
                System.out.println(newLine);
                break;
            }
            line = newLine;
        }
    }

    private static String clean2(String line) {
        Stack<Character> s = new Stack<Character>();
        for(char c : line.toCharArray()) {
            if (! s.isEmpty() && s.peek() == c)
                s.pop();
            else
                s.push(c);
        }
        StringBuffer b = new StringBuffer();
        while (!s.isEmpty()) {
            b.insert(0, s.pop());
        }
    return b.toString();
    }
    private static String clean(String line) {
        StringBuffer t = new StringBuffer();
        char pc = 0;
        int state = 0;
        for (char c : line.toCharArray()) {
            if (state == 0) {
                pc = c;
                state = 1;
            } else {
                if (pc != c) {
                    if (t.length() > 0 && t.charAt(t.length()-1) == pc) {
                        t.deleteCharAt(t.length()-1);
                    }
                    else
                        t.append(pc);
                    pc = c;
                } else {
                    state = 0;
                }
            }
        }
        if (state == 1)
            t.append(pc);
        return t.toString();
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;

public class ProblemA {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line = reader.readLine();
        String newLine = clean2(line);
        System.out.println(newLine);

//        while (true) {
//            String newLine = clean2(line);
//            if (newLine.length() == line.length()) {
//                System.out.println(newLine);
//                break;
//            }
//            line = newLine;
//        }
    }

    private static String clean2(String line) {
        char[] s = new char[line.length()];
        int l = 0;
        for(char c : line.toCharArray()) {
            if (l > 0 && s[l-1] == c)
                l --;
            else
                s[l++] = c;
        }
        return new String(s, 0, l);
    }

    private static String clean(String line) {
        StringBuffer t = new StringBuffer();
        char pc = 0;
        int state = 0;
        for (char c : line.toCharArray()) {
            if (state == 0) {
                pc = c;
                state = 1;
            } else {
                if (pc != c) {
                    if (t.length() > 0 && t.charAt(t.length()-1) == pc) {
                        t.deleteCharAt(t.length()-1);
                    }
                    else
                        t.append(pc);
                    pc = c;
                } else {
                    state = 0;
                }
            }
        }
        if (state == 1)
            t.append(pc);
        return t.toString();
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;

public class ProblemA {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line = reader.readLine();
        String newLine = clean2(line);
        System.out.println(newLine);

//        while (true) {
//            String newLine = clean2(line);
//            if (newLine.length() == line.length()) {
//                System.out.println(newLine);
//                break;
//            }
//            line = newLine;
//        }
    }

    private static String clean2(String line) {
        Stack<Character> s = new Stack<Character>();
        for(char c : line.toCharArray()) {
            if (! s.isEmpty() && s.peek() == c)
                s.pop();
            else
                s.push(c);
        }
        StringBuffer b = new StringBuffer();
        while (!s.isEmpty()) {
            b.append(s.pop());
        }
        return b.reverse().toString();
    }

    private static String clean(String line) {
        StringBuffer t = new StringBuffer();
        char pc = 0;
        int state = 0;
        for (char c : line.toCharArray()) {
            if (state == 0) {
                pc = c;
                state = 1;
            } else {
                if (pc != c) {
                    if (t.length() > 0 && t.charAt(t.length()-1) == pc) {
                        t.deleteCharAt(t.length()-1);
                    }
                    else
                        t.append(pc);
                    pc = c;
                } else {
                    state = 0;
                }
            }
        }
        if (state == 1)
            t.append(pc);
        return t.toString();
    }

}


package leetcode;
import java.util.*;
import java.io.*;

public class Solution {
public String plug(String input){
	int len = input.length();
	int prev_len = 0;
	if(len == 0)
		return "";
	while(prev_len - len != 0){
		String s = "";
		int i = 0;
		while(i < len){
			if(i+1 < len && input.charAt(i) == input.charAt(i+1) ){
				i = i + 2;

			}
			else if (i < len){
				s += input.charAt(i);
				++i;
			}

		}
		input = s;
		prev_len = len;
		len = input.length();
	}
	return input;

}

public static void main(String[] args) throws IOException{

    	BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    	Solution a = new Solution();

    	String input = reader.readLine();

    	String result = a.plug(input);
    	System.out.println(result);

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ProblemA {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line = reader.readLine();

        while (true) {
            String newLine = clean(line);
            if (newLine.length() == line.length()) {
                System.out.println(newLine);
                break;
            }
            line = newLine;
        }
    }

    private static String clean(String line) {
        StringBuffer t = new StringBuffer();
        char pc = 0;
        int state = 0;
        for (int i = 0; i < line.length(); i++) {
            char c = line.charAt(i);
            if (state == 0) {
                pc = c;
                state = 1;
            } else {
                if (pc != c) {
                    t.append(pc);
                    pc = c;
                } else {
                    state = 0;
                }
            }
        }
        if (state == 1)
            t.append(pc);
        return t.toString();
    }

}


import java.util.*;
import java.io.*;

public class Solution {
public String plug(String input){
	int len = input.length();
	int prev_len = 0;
	if(len == 0)
		return "";
	while(prev_len - len != 0){
		String s = "";
		int i = 0;
		while(i < len){
			if(i+1 < len && input.charAt(i) == input.charAt(i+1) ){
				i = i + 2;

			}
			else if (i < len){
				s += input.charAt(i);
				++i;
			}

		}
		input = s;
		prev_len = len;
		len = input.length();
	}
	return input;

}

public static void main(String[] args) throws IOException{

    	BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    	Solution a = new Solution();

    	String input = reader.readLine();

    	String result = a.plug(input);
    	System.out.println(result);

    }
}


import java.io.*;
import java.util.*;
import java.math.*;

public class A {
    private void solve() throws IOException {
        String s = nextToken();
        String res = "";
        while (true) {
            int n = s.length();
            String g = "";
            for (int i = 0 ; i < s.length() ; i++) {
                if (i+1 < s.length() && s.charAt(i) == s.charAt(i+1)) {
                    i++;
                }else {
                    g += s.charAt(i);
                }
            }
            res = g;
            s = res;
            if (n == res.length())
                break;
        }
        System.out.println(res);
    }

    public static void main(String[] args) {
        new A().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int[] readIntArray(int size) throws IOException {
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    long[] readLongArray(int size) throws IOException {
        long[] res = new long[size];
        for (int i = 0; i < size; i++) {
            res[i] = nextLong();
        }
        return res;
    }

    double[] readDoubleArray(int size) throws IOException {
        double[] res = new double[size];
        for (int i = 0; i < size; i++) {
            res[i] = nextDouble();
        }
        return res;
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    BigInteger nextBigInteger() throws IOException {
        return new BigInteger(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}


import java.io.*;
import java.util.*;
import java.math.*;

public class A {
    private void solve() throws IOException {
        String s = nextToken();
        StringBuilder b = new StringBuilder();
        for (int i = 0 ; i < s.length() ; i++) {
            if (b.length() != 0 && b.charAt(b.length() - 1) == s.charAt(i)) {
                b.deleteCharAt(b.length() - 1);
            }else{
                b.append(s.charAt(i));
            }
        }
        System.out.println(b.toString());
    }

    public static void main(String[] args) {
        new A().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int[] readIntArray(int size) throws IOException {
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    long[] readLongArray(int size) throws IOException {
        long[] res = new long[size];
        for (int i = 0; i < size; i++) {
            res[i] = nextLong();
        }
        return res;
    }

    double[] readDoubleArray(int size) throws IOException {
        double[] res = new double[size];
        for (int i = 0; i < size; i++) {
            res[i] = nextDouble();
        }
        return res;
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    BigInteger nextBigInteger() throws IOException {
        return new BigInteger(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}


import java.io.*;
import java.util.*;
import java.math.*;

public class A {
    private void solve() throws IOException {
        String s = nextToken();
        Stack <Character> st = new Stack<Character>();
        String res = "";
        for (int i = 0 ; i < s.length() ; i++) {
            if (!st.isEmpty() && st.peek().equals(s.charAt(i))) {
                st.pop();
                continue;
            }
            st.push(s.charAt(i));
        }
        int n = st.size();
        for (int i = 0; i <n; i++) {
            res = st.pop() + res;
        }
        System.out.println(res);
    }

    public static void main(String[] args) {
        new A().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int[] readIntArray(int size) throws IOException {
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    long[] readLongArray(int size) throws IOException {
        long[] res = new long[size];
        for (int i = 0; i < size; i++) {
            res[i] = nextLong();
        }
        return res;
    }

    double[] readDoubleArray(int size) throws IOException {
        double[] res = new double[size];
        for (int i = 0; i < size; i++) {
            res[i] = nextDouble();
        }
        return res;
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    BigInteger nextBigInteger() throws IOException {
        return new BigInteger(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        String str = reader.readLine();
        Stack<Character> res = new Stack<Character>();
        for (int i = 0; i < str.length(); i++) {
            if (!res.isEmpty() && res.peek() == str.charAt(i)) {
                res.pop();
            } else {
                res.push(str.charAt(i));
            }
        }
        for (int i=0;i<res.size();i++) {
            System.out.print(res.get(i));
        }

        System.out.println();

        reader.close();
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class JavaApplication1 {

    public static void main(String[] args) throws IOException {
        BufferedReader I = new BufferedReader(new InputStreamReader(System.in));
        String st = I.readLine();
        System.out.println(cc(st,true));
    }

    static String cc(String aa, boolean flag) {
        StringBuffer a = new StringBuffer(aa);
        if (flag) {
            char temp = ' ';
            flag=false;
            for (int i = 1; i < a.length(); i++) {
                temp = a.charAt(i);
                if (temp == a.charAt(i - 1)) {
                    a.deleteCharAt(i);
                    a.deleteCharAt(i - 1);
                    flag = true;
                }
            }
            cc(a.toString(),flag);
        } else {
            return a.toString();
        }
       return a.toString();
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Vector;

public class JavaApplication1 {

    public static void main(String[] args) throws IOException {
        BufferedReader I = new BufferedReader(new InputStreamReader(System.in));
        String st = I.readLine();
        Vector<String> a=new Vector<>();
        for(int i=0;i<st.length();i++){
            a.insertElementAt(st.charAt(i)+"",i);

        }

        for (int i =  a.size()-1; i > 0; i--) {

            if (a.get(i).equals(a.get(i-1))) {
                a.remove(i);
                a.remove(i - 1);
                a.trimToSize();
                i= a.size();

            }
        }
        for(int i=0;i<a.size();i++){
            System.out.print(a.get(i));
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class JavaApplication1 {

    public static void main(String[] args) throws IOException {
        BufferedReader I = new BufferedReader(new InputStreamReader(System.in));
        String st = I.readLine();
        int a[]=new int [27];
        String aaa = "";
        for(int i=0;i<st.length();i++){
            a[(int)st.charAt(i)-97]++;
            if(!aaa.contains(st.charAt(i)+""))
            aaa+=st.charAt(i);

        }
        int j=0;
       char aa []= new char[st.length()];
       for(int i=0;i<a.length;i++){
           if(a[i]%2!=0&&a[i]!=0){
               aa[j++]=(char)(i+97);
           }
       }
       String out="";
       for(char s:aaa.toCharArray()){
          for(int i=0;i<aa.length;i++){
              if(s==aa[i]){
                  out+=s;
                  aa[i]=' ';
                  break;
              }
          }
       }
       if(!out.equals(""))
        System.out.println(out);
       else
            System.out.println("babababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababa");

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Vector;

public class JavaApplication1 {

    public static void main(String[] args) throws IOException {
        BufferedReader I = new BufferedReader(new InputStreamReader(System.in));
        String st = I.readLine();
        Vector<Character> a=new Vector<Character>();
        for(int i=0;i<st.length();i++){
            a.insertElementAt(st.charAt(i),i);

        }

        for (int i =  a.size()-1; i > 0; i--) {

            if (a.get(i)==(a.get(i-1))) {
                a.remove(i);
                a.remove(i - 1);
                a.trimToSize();
                i= a.size();

            }
        }
        for(int i=0;i<a.size();i++){
            System.out.print(a.get(i));
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class JavaApplication1 {

    public static void main(String[] args) throws IOException {
        BufferedReader I = new BufferedReader(new InputStreamReader(System.in));
        String st = I.readLine();
        int a[]=new int [27];
        for(int i=0;i<st.length();i++){
            a[(int)st.charAt(i)-97]++;
        }
        int j=0;
       char aa []= new char[st.length()];
       for(int i=0;i<a.length;i++){
           if(a[i]%2!=0&&a[i]!=0){
               aa[j++]=(char)(i+97);
           }
       }

       for(char s:st.toCharArray()){
          for(int i=0;i<aa.length;i++){
              if(s==aa[i]){
                  System.out.print(s);
                  aa[i]=' ';
              }
          }
       }

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Vector;

public class JavaApplication1 {

    public static void main(String[] args) throws IOException {
        BufferedReader I = new BufferedReader(new InputStreamReader(System.in));
        String st = I.readLine();
        Vector<String> a=new Vector<String>();
        for(int i=0;i<st.length();i++){
            a.insertElementAt(st.charAt(i)+"",i);

        }

        for (int i =  a.size()-1; i > 0; i--) {

            if (a.get(i).equals(a.get(i-1))) {
                a.remove(i);
                a.remove(i - 1);
                a.trimToSize();
                i= a.size();

            }
        }
        for(int i=0;i<a.size();i++){
            System.out.print(a.get(i));
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class JavaApplication1 {

    public static void main(String[] args) throws IOException {
        BufferedReader I = new BufferedReader(new InputStreamReader(System.in));
        String st = I.readLine();
        System.out.println(cc(st,true));
    }

    static String cc(String aa, boolean flag) {
        StringBuffer a = new StringBuffer(aa);
        if (flag) {
            char temp = ' ';
            flag=false;
            for (int i = 1; i < a.length(); i++) {
                temp = a.charAt(i);
                if (temp == a.charAt(i - 1)) {
                    a.deleteCharAt(i);
                    a.deleteCharAt(i - 1);
                    flag = true;
                }
            }
            cc(a.toString(),flag);
        }
        else
            return a.toString();
       return cc(a.toString(),flag);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class JavaApplication1 {

    public static void main(String[] args) throws IOException {
        BufferedReader I = new BufferedReader(new InputStreamReader(System.in));
        String st = I.readLine();
        int a[]=new int [27];
        String aaa = "";
        for(int i=0;i<st.length();i++){
            a[(int)st.charAt(i)-97]++;
            if(!aaa.contains(st.charAt(i)+""))
            aaa+=st.charAt(i);

        }
        int j=0;
       char aa []= new char[st.length()];
       for(int i=0;i<a.length;i++){
           if(a[i]%2!=0&&a[i]!=0){
               aa[j++]=(char)(i+97);
           }
       }

       for(char s:aaa.toCharArray()){
          for(int i=0;i<aa.length;i++){
              if(s==aa[i]){
                  System.out.print(s);
                  aa[i]=' ';
                  break;
              }
          }
       }

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class JavaApplication1 {

    public static void main(String[] args) throws IOException {
        BufferedReader I = new BufferedReader(new InputStreamReader(System.in));
        String st = I.readLine();
        StringBuffer a = new StringBuffer(st);
        char temp = ' ';
        for (int i = 1; i < a.length(); i++) {
            temp = a.charAt(i);
            if (temp == a.charAt(i - 1)) {
                a.deleteCharAt(i);
                a.deleteCharAt(i - 1);
                i=1;
            }
        }
        System.out.println(a);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class JavaApplication1 {

    public static void main(String[] args) throws IOException {
        BufferedReader I = new BufferedReader(new InputStreamReader(System.in));
        String st = I.readLine();
        StringBuffer a = new StringBuffer(st);
        char temp = ' ';
        for (int i =  a.length()-1; i > 0; i--) {
            temp = a.charAt(i);
            if (temp == a.charAt(i- 1)) {
                a.deleteCharAt(i);
                a.deleteCharAt(i - 1);
                a.trimToSize();
                i= a.length();

            }
        }
        System.out.println(a);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class JavaApplication1 {

    public static void main(String[] args) throws IOException {
        BufferedReader I = new BufferedReader(new InputStreamReader(System.in));
        String st = I.readLine();
        int a[]=new int [27];
        for(int i=0;i<st.length();i++){
            a[(int)st.charAt(i)-97]++;
        }
        int j=0;
       char aa []= new char[st.length()];
       for(int i=0;i<a.length;i++){
           if(a[i]%2!=0&&a[i]!=0){
               aa[j++]=(char)(i+97);
           }
       }

       for(char s:st.toCharArray()){
          for(int i=0;i<aa.length;i++){
              if(s==aa[i]){
                  System.out.print(s);
                  aa[i]=' ';
                  break;
              }
          }
       }

    }
}


import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
    public static String fileIn = "Input.txt";
    public static String fileOut = "Output.txt";
    public static final String noNextString = "This is the end";
    public static final String noNext = "-1";

   public static void processString(StringBuilder tmp) {
	  int i = 0;
	  while (i < tmp.length()-1) {
			if (tmp.charAt(i) == tmp.charAt(i + 1)) {
				tmp.deleteCharAt(i);
				tmp.deleteCharAt(i);
				if ( i - 1 >=0) --i;
			} else {
				++i;
			}
		}
   }

    public static void main(String[] args) throws Exception {
        PrintWriter jout = new PrintWriter(System.out);
        Scanner jin = new Scanner(new InputStreamReader(System.in));
       // PrintWriter joutf = new PrintWriter(new FileWriter(fileOut));
      //  Scanner jinf = new Scanner(new FileReader(fileIn));
      //  BufferedReader BufIn = new BufferedReader(new FileReader(fileIn));

        StringBuilder in = new StringBuilder(jin.next());
        processString(in);
        jout.println(in);
       // joutf.close();
        jout.close();
    }

}


import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main {
	public static String fileIn = "Input.txt";
	public static String fileOut = "Output.txt";

	public static int[][] readData() throws FileNotFoundException {
		Scanner jin = new Scanner(new InputStreamReader(new FileInputStream("input.txt")));

		int[][] result = new int[jin.nextInt()][jin.nextInt()];
		for (int i = 0; i < result.length; ++i) {
			for (int j = 0; j < result[i].length; ++j) {
				result[i][j] = jin.nextInt();
			}
		}
		return result;
	}

	public static int minColumnMax(int[][] mas) {
		ArrayList<Integer> colmax = new ArrayList<Integer>();
		for (int column = 0; column < mas[0].length; ++column) {
			int max = Integer.MIN_VALUE;
			for (int row = 0; row < mas.length; ++row) {
				if (mas[row][column] > max) max = mas[row][column];
			}
			colmax.add(max);
		}
		return Collections.min(colmax);
	}

	public static int maxRowMin(int[][] mas) {
		ArrayList<Integer> rowmin = new ArrayList<Integer>();
		for (int row = 0; row < mas.length; ++row) {
			int min = Integer.MAX_VALUE;
			for (int column = 0; column < mas[row].length; ++column) {
				if (mas[row][column] < min) min = mas[row][column];
			}
			rowmin.add(min);
		}
		return Collections.max(rowmin);
	}

	public static void main(String[] args) throws Exception {
		//PrintWriter jout = new PrintWriter(new FileWriter("output.txt"));
		//Scanner jin = new Scanner(new FileReader("input.txt"));
		Scanner jin = new Scanner(new InputStreamReader(System.in));
		String a = jin.next();
		//String b = jin.next();
		String regex = "(\\w)\\1";

		while (!a.equals(a.replaceAll(regex, ""))) {
		//	System.out.println(a);
			a = a.replaceAll(regex, "");
		}
		System.out.println(a);

		//jout.close();
	}

	public static long binpow(long a, long n) {
		long res = 1;
		while (n > 0) {
			if ((n & 1) == 1)
				res *= a;

			a *= a;
			n >>= 1;
		}
		return res;
	}
}


import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {
    public static String fileIn = "Input.txt";
    public static String fileOut = "Output.txt";
    public static final String noNextString = "This is the end";
    public static final String noNext = "-1";

   public static Stack<Character> processString(StringBuilder tmp) {
	  Stack<Character> result = new Stack<Character>();
	  for (int i = 0; i < tmp.length(); ++i) {
		  if (result.isEmpty()) {
			  result.add(tmp.charAt(i));
		  }
		  else if (tmp.charAt(i) == result.peek()) {
			  result.pop();
		  }
		  else {
			 result.push(tmp.charAt(i));
		  }
	  }
	  return result;

   }

    public static void main(String[] args) throws Exception {
        PrintWriter jout = new PrintWriter(System.out);
        Scanner jin = new Scanner(new InputStreamReader(System.in));
       // PrintWriter joutf = new PrintWriter(new FileWriter(fileOut));
      //  Scanner jinf = new Scanner(new FileReader(fileIn));
      //  BufferedReader BufIn = new BufferedReader(new FileReader(fileIn));

        StringBuilder in = new StringBuilder(jin.next());
        List<Character> t = processString(in);
        String result = "";
        for (int i = 0; i < t.size(); ++i) {
        	result += t.get(i);
        }
        jout.println(result);
        // joutf.close();
        jout.close();
    }

}


import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;

public class Main {
    public static String fileIn = "Input.txt";
    public static String fileOut = "Output.txt";
    public static final String noNextString = "This is the end";
    public static final String noNext = "-1";

   public static Stack<Character> processString(StringBuilder tmp) {
	  Stack<Character> result = new Stack<Character>();
	  for (int i = 0; i < tmp.length(); ++i) {
		  if (result.isEmpty()) {
			  result.add(tmp.charAt(i));
		  }
		  else if (tmp.charAt(i) == result.peek()) {
			  result.pop();
		  }
		  else {
			 result.push(tmp.charAt(i));
		  }
	  }
	  return result;

   }

    public static void main(String[] args) throws Exception {
        PrintWriter jout = new PrintWriter(System.out);
        Scanner jin = new Scanner(new InputStreamReader(System.in));
       // PrintWriter joutf = new PrintWriter(new FileWriter(fileOut));
      //  Scanner jinf = new Scanner(new FileReader(fileIn));
      //  BufferedReader BufIn = new BufferedReader(new FileReader(fileIn));

        StringBuilder in = new StringBuilder(jin.next());
        List<Character> t = processString(in);
        for (int i = 0; i < t.size(); ++i) {
        	   jout.print(t.get(i));
        }
        // joutf.close();
        jout.close();
    }

}


import java.util.Scanner;

public class Prob081A
{
    public static void main( String[] Args )
    {
        Scanner scan = new Scanner( System.in );
        StringBuffer sb = new StringBuffer( scan.next() );
        int i = 1;
        while ( i < sb.length() )
        {
            if ( sb.charAt( i - 1 ) == sb.charAt( i ) )
            {
                sb.delete( i - 1, i + 1 );
                i -= 2;
            }
            i += 1;
            if ( i < 1 )
                i++;
        }
        System.out.println( sb );
    }
}


import java.util.Scanner;

public class Prob081A
{
    public static void main( String[] Args )
    {
        Scanner scan = new Scanner( System.in );
        StringBuffer sb = new StringBuffer( scan.next() );
        for (int i = 1;  i < sb.length(); i++ )
        {
            if ( sb.charAt( i - 1 ) == sb.charAt( i ) )
            {
                sb.delete( i - 1, i + 1 );
                i -= 2;
            }
            if ( i < 0 )
                i++;
        }
        System.out.println( sb );
    }
}


import java.util.Scanner;

public class Prob081A
{
    public static void main( String[] Args )
    {
        Scanner scan = new Scanner( System.in );
        StringBuffer sb = new StringBuffer( scan.next() );

        while ( removePairs( sb ) )
        {
        }

        System.out.println( sb );
    }

    public static boolean removePairs( StringBuffer sb )
    {
        boolean removeable = false;
        for ( int x = 0; x < sb.length() - 1; x++ )
        {
            if ( sb.charAt( x ) == sb.charAt( x + 1 ) )
            {
                sb.delete( x, x-- + 2 );
                removeable = true;
            }
        }

        return removeable;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Prob081A
{
    public static void main( String[] Args ) throws IOException
    {
        BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
        String s = br.readLine();
        StringBuffer sb = new StringBuffer();

        for ( int x = 0; x < s.length(); x++ )
        {
            sb.append( s.charAt( x ) );
            int l = sb.length();
            if ( l >= 2 && sb.charAt( l - 1 ) == sb.charAt( l - 2 ) )
                sb.delete( l - 2, l );
        }

        System.out.println( sb );
    }
}


import java.util.*;
import java.io.*;
public class YandexA{
    static BufferedReader br;
    public static void main(String args[])throws Exception{
        br=new BufferedReader(new InputStreamReader(System.in));
        String str=toStr();
        char chs[]=str.toCharArray();
        ArrayList<Character> ar=new ArrayList();
        ar.add(str.charAt(0));
        int last=0;
        for(int i=1;i<chs.length;i++){
            char c;
            if(last!=-1){
                c=ar.get(last);
            }
            else{
                c='A';
            }
            if(c==chs[i]){
                ar.remove(last);
                last--;
            }
            else{
                ar.add(chs[i]);
                last++;
            }

        }
        String res="";
        int l=ar.toString().length();

        res=ar.toString().substring(1,l-1).replace(", ","");

        System.out.println(res);

        /*for(int i=0;i<sb.length()-1;i++){
           if(sb.charAt(i)==sb.charAt(i+1)){
               sb.delete(i,i+2);
               i=i-2;
               if(i<0)
                   i=-1;
           }

        }
         *
         */

    }

    /****************************************************************/
    public static int[] toIntArray()throws Exception{
       String str[]=br.readLine().split(" ");
       int k[]=new int[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Integer.parseInt(str[i]);
       }
       return k;
    }
    public static int toInt()throws Exception{
       return Integer.parseInt(br.readLine());
    }
    public static long[] toLongArray()throws Exception{
       String str[]=br.readLine().split(" ");
       long k[]=new long[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Long.parseLong(str[i]);
       }
       return k;
    }
    public static long toLong()throws Exception{
       return Long.parseLong(br.readLine());
    }
    public static double[] toDoubleArray()throws Exception{
       String str[]=br.readLine().split(" ");
       double k[]=new double[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Double.parseDouble(str[i]);
       }
       return k;
    }
    public static double toDouble()throws Exception{
       return Double.parseDouble(br.readLine());
    }
    public static String toStr()throws Exception{
       return br.readLine();
    }
    public static String[] toStrArray()throws Exception{
       String str[]=br.readLine().split(" ");
       return str;
    }
    /****************************************************************/

}


import java.util.*;
import java.io.*;
public class YandexA{
    static BufferedReader br;
    public static void main(String args[])throws Exception{
        br=new BufferedReader(new InputStreamReader(System.in));
        String str=toStr();
        char chs[]=str.toCharArray();
        ArrayList<Character> ar=new ArrayList();
        ar.add(str.charAt(0));
        int last=0;
        for(int i=1;i<chs.length;i++){
            char c;
            if(last!=-1){
                c=ar.get(last);
            }
            else{
                c='A';
            }
            if(c==chs[i]){
                ar.remove(last);
                last--;
            }
            else{
                ar.add(chs[i]);
                last++;
            }

        }
        String res="";
        for(int i=0;i<ar.size();i++){
            res+=ar.get(i);
        }

        System.out.println(res);

        /*for(int i=0;i<sb.length()-1;i++){
           if(sb.charAt(i)==sb.charAt(i+1)){
               sb.delete(i,i+2);
               i=i-2;
               if(i<0)
                   i=-1;
           }

        }
         *
         */

    }

    /****************************************************************/
    public static int[] toIntArray()throws Exception{
       String str[]=br.readLine().split(" ");
       int k[]=new int[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Integer.parseInt(str[i]);
       }
       return k;
    }
    public static int toInt()throws Exception{
       return Integer.parseInt(br.readLine());
    }
    public static long[] toLongArray()throws Exception{
       String str[]=br.readLine().split(" ");
       long k[]=new long[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Long.parseLong(str[i]);
       }
       return k;
    }
    public static long toLong()throws Exception{
       return Long.parseLong(br.readLine());
    }
    public static double[] toDoubleArray()throws Exception{
       String str[]=br.readLine().split(" ");
       double k[]=new double[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Double.parseDouble(str[i]);
       }
       return k;
    }
    public static double toDouble()throws Exception{
       return Double.parseDouble(br.readLine());
    }
    public static String toStr()throws Exception{
       return br.readLine();
    }
    public static String[] toStrArray()throws Exception{
       String str[]=br.readLine().split(" ");
       return str;
    }
    /****************************************************************/

}


import java.util.*;
import java.io.*;
public class YandexA{
    static BufferedReader br;
    public static void main(String args[])throws Exception{
        br=new BufferedReader(new InputStreamReader(System.in));
        String str=toStr();
        StringBuilder sb=new StringBuilder(str);
        //char ch[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
        for(int i=0;i<sb.length()-1;i++){
           if(sb.charAt(i)==sb.charAt(i+1)){
               sb.deleteCharAt(i+1);
               sb.deleteCharAt(i);
               i=i-2;
               if(i<0)
                   i=-1;
           }

        }
        System.out.println(sb.toString());

    }

    /****************************************************************/
    public static int[] toIntArray()throws Exception{
       String str[]=br.readLine().split(" ");
       int k[]=new int[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Integer.parseInt(str[i]);
       }
       return k;
    }
    public static int toInt()throws Exception{
       return Integer.parseInt(br.readLine());
    }
    public static long[] toLongArray()throws Exception{
       String str[]=br.readLine().split(" ");
       long k[]=new long[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Long.parseLong(str[i]);
       }
       return k;
    }
    public static long toLong()throws Exception{
       return Long.parseLong(br.readLine());
    }
    public static double[] toDoubleArray()throws Exception{
       String str[]=br.readLine().split(" ");
       double k[]=new double[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Double.parseDouble(str[i]);
       }
       return k;
    }
    public static double toDouble()throws Exception{
       return Double.parseDouble(br.readLine());
    }
    public static String toStr()throws Exception{
       return br.readLine();
    }
    public static String[] toStrArray()throws Exception{
       String str[]=br.readLine().split(" ");
       return str;
    }
    /****************************************************************/

}


import java.util.*;
import java.io.*;
public class YanA{
    static BufferedReader br;
    public static void main(String args[])throws Exception{
        br=new BufferedReader(new InputStreamReader(System.in));
        String str=toStr();
        StringBuilder sb=new StringBuilder(str);
        //char ch[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
        for(int i=0;i<sb.length()-1;i++){

            if(sb.charAt(i)==sb.charAt(i+1)){
               sb.deleteCharAt(i+1);
               sb.deleteCharAt(i);
               i=i-2;

               if(i<0)
                   i=-1;
           }

        }
        System.out.println(sb.toString());

    }

    /****************************************************************/
    public static int[] toIntArray()throws Exception{
       String str[]=br.readLine().split(" ");
       int k[]=new int[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Integer.parseInt(str[i]);
       }
       return k;
    }
    public static int toInt()throws Exception{
       return Integer.parseInt(br.readLine());
    }
    public static long[] toLongArray()throws Exception{
       String str[]=br.readLine().split(" ");
       long k[]=new long[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Long.parseLong(str[i]);
       }
       return k;
    }
    public static long toLong()throws Exception{
       return Long.parseLong(br.readLine());
    }
    public static double[] toDoubleArray()throws Exception{
       String str[]=br.readLine().split(" ");
       double k[]=new double[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Double.parseDouble(str[i]);
       }
       return k;
    }
    public static double toDouble()throws Exception{
       return Double.parseDouble(br.readLine());
    }
    public static String toStr()throws Exception{
       return br.readLine();
    }
    public static String[] toStrArray()throws Exception{
       String str[]=br.readLine().split(" ");
       return str;
    }
    /****************************************************************/

}


import java.util.*;
import java.io.*;
public class YanA{
    static BufferedReader br;
    public static void main(String args[])throws Exception{
        br=new BufferedReader(new InputStreamReader(System.in));
        String str=toStr();
        StringBuilder sb=new StringBuilder(str);
        //char ch[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
        int l=sb.length();
        for(int i=0;i<l-1;i++){

            if(sb.charAt(i)==sb.charAt(i+1)){
               sb.deleteCharAt(i+1);
               sb.deleteCharAt(i);
               i=i-2;
               l=l-2;
               if(i<0)
                   i=-1;
           }
        }
        System.out.println(sb.toString());

    }

    /****************************************************************/
    public static int[] toIntArray()throws Exception{
       String str[]=br.readLine().split(" ");
       int k[]=new int[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Integer.parseInt(str[i]);
       }
       return k;
    }
    public static int toInt()throws Exception{
       return Integer.parseInt(br.readLine());
    }
    public static long[] toLongArray()throws Exception{
       String str[]=br.readLine().split(" ");
       long k[]=new long[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Long.parseLong(str[i]);
       }
       return k;
    }
    public static long toLong()throws Exception{
       return Long.parseLong(br.readLine());
    }
    public static double[] toDoubleArray()throws Exception{
       String str[]=br.readLine().split(" ");
       double k[]=new double[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Double.parseDouble(str[i]);
       }
       return k;
    }
    public static double toDouble()throws Exception{
       return Double.parseDouble(br.readLine());
    }
    public static String toStr()throws Exception{
       return br.readLine();
    }
    public static String[] toStrArray()throws Exception{
       String str[]=br.readLine().split(" ");
       return str;
    }
    /****************************************************************/

}


import java.util.*;
public class A81 {
	public static void main(String args[]){
		Scanner s = new Scanner(System.in);
		char[] s1 = s.next().toCharArray();
		int  l = s1.length;
		char[] stack = new char[999999];
		int cnt = 0;
		stack[0]='-';
		for(int i = 0; i < l ; i++){
			if(s1[i]==stack[cnt]){
				cnt--;

			}
			else{
				cnt++;
				stack[cnt]=s1[i];
			}
		}
		String out ="";
		for(int i = 1;i<=cnt;i++){
			out+=stack[i];

		}
		System.out.println(out);

	}

}


import java.util.*;
public class A81 {
	public static void main(String args[]){
		Scanner s = new Scanner(System.in);
		String s1 = s.nextLine();
		long  l = s1.length();

		Stack<Character> st = new Stack<Character>();
		st.add(s1.charAt(0));
		for(int i = 1; i < l ; i++){
			if(!st.isEmpty()){
				if (s1.charAt(i)==st.peek()) st.pop();
				else st.add(s1.charAt(i));
			}
			else st.add(s1.charAt(i));
		}
		for( char c : st){
			System.out.print(c);
		}

	}

}


import java.util.*;
public class A81 {
	public static void main(String args[]){
		Scanner s = new Scanner(System.in);
		String s1 = s.next();
		long  l = s1.length();
		char[] stack = new char[9999999];
		int cnt = 0;
		stack[0]='-';
		for(int i = 0; i < l ; i++){
			if(s1.charAt(i)==stack[cnt]){
				cnt--;

			}
			else{
				cnt++;
				stack[cnt]=s1.charAt(i);
			}
		}
		String out ="";
		for(int i = 1;i<=cnt;i++){
			out+=stack[i];
		}
		System.out.println(out);

	}

}


import java.util.ArrayList;
import java.util.Scanner;

public class PlugIn_81A {

    private static ArrayList<Character> stack = new ArrayList<Character>(0);

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] str = sc.nextLine().toCharArray();

        for (int i = 0; i < str.length; i++) {
            pushStack(str[i]);
        }
        StringBuilder sb = new StringBuilder();
        int size = stack.size();
        for (int i=0; i<size; i++) {
            sb.append(stack.remove(0));
        }
        System.out.println(sb.toString());
    }

    private static void pushStack(char a) {
        if (stack.size() == 0) {
            stack.add(a);
        } else {
            if (stack.get(stack.size() - 1) == a) {
                stack.remove(stack.size() - 1);
            } else {
                stack.add(a);
            }
        }
    }
}


import java.util.ArrayList;
import java.util.Scanner;

public class PlugIn_81A {

    private static ArrayList<Character> stack = new ArrayList<Character>(0);

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] str = sc.nextLine().toCharArray();

        for (int i = 0; i < str.length; i++) {
            pushStack(str[i]);
        }
        StringBuilder sb = new StringBuilder();
        int size = stack.size();
        for (int i = 0; i < size; i++) {
            sb.append(stack.get(i));
        }
        System.out.println(sb.toString());
    }

    private static void pushStack(char a) {
        if (stack.size() == 0) {
            stack.add(a);
        } else {
            if (stack.get(stack.size() - 1) == a) {
                stack.remove(stack.size() - 1);
            } else {
                stack.add(a);
            }
        }
    }
}


import java.util.Scanner;

public class PlugIn_81A {

    private static char[] str;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        str = sc.nextLine().toCharArray();

        for (int i = 0; i < str.length; i++) {
            char test = str[i];
            if (test=='\u0000') continue;
            int length = seq(test,i);
            if (length>1) {
                for (int j=i; j<length+i; j++) {
                    str[j]='\u0000';
                }
            }
        }

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < str.length; i++) {
            if (str[i] != '\u0000')
                sb.append(str[i]);
        }
        System.out.println(sb.toString());
    }

    private static int seq(char a, int start) {
        int count = 0;
        for (int j=start; j<str.length; j++) {
            if (str[j]==a) {
                count++;
            } else {
                break;
            }
        }
        return count;
    }
}


import java.io.*;
import java.util.*;
import java.math.*;

public class A {
	Scanner sc;
	Formatter formatter;

	public void init() {
		sc = new Scanner(System.in);
		formatter = new Formatter((Appendable) System.out);
	}

	public void run() {
		String buffer = sc.nextLine();
		int map[] = new int[256];
		for(char x : buffer.toCharArray()){
			map[x] ++;
		}
		for(int i = 0 ; i < 256;i++){
			if(map[i] % 2 == 1){
				System.out.print((char)i);
			}
		}
		System.out.println();
	}

	public static void main(String[] args) {
		A t = new A();
		t.init();
		t.run();
	}
}


import java.io.*;
import java.util.*;
import java.math.*;

public class A {
	Scanner sc;
	Formatter formatter;

	public void init() {
		sc = new Scanner(System.in);
		formatter = new Formatter((Appendable) System.out);
	}

	public void run() {
		char[] buffer = sc.nextLine().toCharArray();
		LinkedList<Character> List = new LinkedList<Character>();
		for(int i = 0 ;i < buffer.length;i++){
			if(List.isEmpty()){
				List.addFirst(buffer[i]);
			}else{
				if(List.getFirst() == buffer[i]){
					List.removeFirst();
				}else{
					List.addFirst(buffer[i]);
				}
			}
		}
		for(char x : List){
			System.out.print(x);
		}
	}

	public static void main(String[] args) {
		A t = new A();
		t.init();
		t.run();
	}
}


import java.io.*;
import java.util.*;
import java.math.*;

public class A {
	Scanner sc;
	Formatter formatter;

	public void init() {
		sc = new Scanner(System.in);
		formatter = new Formatter((Appendable) System.out);
	}

	public void run() {
		String buffer = sc.nextLine();
		int map[] = new int[256];
		for(char x : buffer.toCharArray()){
			map[x] ++;
		}
		for(int i = 0 ; i < 256;i++){
			if(map[i] % 2 == 1){
				System.out.print((char)i);
			}
		}
	}

	public static void main(String[] args) {
		A t = new A();
		t.init();
		t.run();
	}

}


import java.io.*;
import java.util.*;
import java.math.*;

public class A {
	Scanner sc;
	Formatter formatter;

	public void init() {
		sc = new Scanner(System.in);
		formatter = new Formatter((Appendable) System.out);
	}

	public void run() {
		char[] buffer = sc.nextLine().toCharArray();
		LinkedList<Character> List = new LinkedList<Character>();
		for(int i = 0 ;i < buffer.length;i++){
			if(List.isEmpty()){
				List.addLast(buffer[i]);
			}else{
				if(List.getLast() == buffer[i]){
					List.removeLast();
				}else{
					List.addLast(buffer[i]);
				}
			}
		}
		for(char x : List){
			System.out.print(x);
		}
	}

	public static void main(String[] args) {
		A t = new A();
		t.init();
		t.run();
	}
}


import java.io.*;
import java.util.*;
import java.math.*;

public class A {
	Scanner sc;
	Formatter formatter;

	public void init() {
		sc = new Scanner(System.in);
		formatter = new Formatter((Appendable) System.out);
	}

	public void run() {
		String buffer = sc.nextLine();
		LinkedList<Character> List = new LinkedList<Character>();
		for(char x : buffer.toCharArray()){
			if(List.contains(x)){
				List.remove((Object)x);
			}else{
				List.add(x);
			}
		}
		for(char x : List){
			System.out.print(x);
		}
	}

	public static void main(String[] args) {
		A t = new A();
		t.init();
		t.run();
	}
}


import java.util.Scanner;

public class PlugIn {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String in = sc.next();
		StringBuilder out = new StringBuilder(in.charAt(0) + "");

		for (int i = 1; i < in.length(); i++) {
			if (out.length() > 0) {
				if (in.charAt(i) != out.charAt(out.length() - 1)) {
					out.append(in.charAt(i));
				} else {
					out.deleteCharAt(out.length() - 1);
				}
			} else {
				out.append(in.charAt(i));
			}
		}
		System.out.println(out);

	}
}


import java.util.Arrays;
import java.util.Scanner;

public class PlugIn {
	static class literal implements Comparable<literal> {
		char cc;
		int count;
		int sort = -1;

		public literal(char k, int c, int s) {
			count = c;
			cc = k;
			sort = s;
		}

		public int compareTo(literal arg0) {
			return sort - arg0.sort;
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String in = sc.next();
		String out = "";
		literal[] list = new literal[26];
		for (int i = 0; i < list.length; i++) {
			list[i] = new literal('-', 0, -1);
		}
		int counter = 0;

		for (int i = 0; i < in.length(); i++) {
			char tempChar = in.charAt(i);
			if (list[tempChar - 'a'].cc == '-') {
				list[tempChar - 'a'].cc = tempChar;
				list[tempChar - 'a'].sort = counter;
				counter++;
			}
			list[tempChar - 'a'].count++;
		}
		Arrays.sort(list);
		for (int i = 0; i < list.length; i++) {
			if (list[i].count % 2 != 0 && list[i].sort != -1) {
				out += list[i].cc;
			}
		}
		System.out.println(out);
	}
}


import java.util.ArrayList;
import java.util.Scanner;

public class PlugIn {
	static class literal {
		char cc;
		int count;

		public literal(char k, int c) {
			count = c;
			cc = k;
		}

		private void incrCount(int co) {
			count += co;
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String in = sc.next();
		String out = "";
		ArrayList<literal> list = new ArrayList<literal>();

		for (int i = 0; i < in.length(); i++) {
			char tempChar = in.charAt(i);
			int index = contains(tempChar, list);
			if (index == -1) {
				list.add(new literal(tempChar, 1));
			} else {
				list.get(index).incrCount(1);
			}
		}
		for (int i = 0; i < list.size(); i++) {
			if ((list.get(i).count & 1) == 1) {
				out += list.get(i).cc;
			}
		}
		System.out.println(out);
	}

	private static int contains(char tempChar, ArrayList<literal> list) {
		for (int i = 0; i < list.size(); i++) {
			if (list.get(i).cc == tempChar)
				return i;
		}
		return -1;
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;

public class A {
    public static void main(final String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String str = reader.readLine();

        StringBuilder res = new StringBuilder(str);
        System.out.println(del(res));

    }

    private static StringBuilder del(StringBuilder str) {
        for (int i = 0; i < str.length(); i++) {
            if (i < str.length() - 1 && str.charAt(i) == str.charAt(i + 1)) {
                str.delete(i, i + 2);
                i =- 2;
                if (i < 0) {
                    i = -1;
                }
            }
        }

        return str;
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;

public class A {
    public static void main(final String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String str = reader.readLine();

        StringBuilder res = new StringBuilder(str);
        int len = res.length();
        while (true) {
            StringBuilder newRes = del(res);
            if (newRes.length() == len) {
                System.out.println(newRes);
                return;
            }
            len = newRes.length();
            res = newRes;
        }

    }

    private static StringBuilder del(StringBuilder str) {
        StringBuilder res = new StringBuilder(str.length());
        for (int i = 0; i < str.length(); i++) {
            if (i < str.length() - 1 && str.charAt(i) == str.charAt(i + 1)) {
                i++;
            }  else {
                res.append(str.charAt(i));
            }
        }

        return res;
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;

public class A {
    public static void main(final String[] args) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String str = reader.readLine();

        StringBuilder res = new StringBuilder(str);
        System.out.println(del(res));

    }

    private static StringBuilder del(StringBuilder str) {
        StringBuilder res = new StringBuilder(str.length());
        for (int i = 0; i < str.length(); i++) {
            if (res.length() != 0 && res.charAt(res.length() - 1) == str.charAt(i)) {
                res.deleteCharAt(res.length() - 1);
            }
            else {
                res.append(str.charAt(i));
            }
        }

        return res;
    }
}


import java.util.*;
public class B {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        char[] ar=sc.next().toCharArray();
        boolean flag=false;
        while(!flag) {
            flag=true;
            for(int i=0,j=1;j<ar.length;i++,j++) {
                while(i<ar.length&&ar[i]=='1') i++;
                if(j<i) j=i+1;
                if(j>ar.length-1) break;
                while(j<ar.length&&ar[j]=='1') j++;
                if(j>ar.length-1) break;
                if(ar[i]==ar[j]) {
                    ar[i]='1';
                    ar[j]='1';
                    i=j;
                    j+=1;
                    flag=false;
                }
            }
        }
        StringBuffer bf=new StringBuffer();
        for(int i=0;i<ar.length;i++) {
            if(ar[i]!='1') {
                bf.append(ar[i]);
            }
        }
        System.out.println(bf);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;

public class A {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String S = in.readLine();
        LinkedList<Character> inp = new LinkedList<Character>();
        for (int i = 0; i < S.length(); i++) {
            inp.addLast(S.charAt(i));
        }
        while(true){
            boolean flag = false;
            for (int i = 0; i < inp.size(); i++) {
                int j = i+1;
                while(j<inp.size()&& inp.get(j)==inp.get(i)){
                    inp.remove(j);
                    flag = true;
                    j++;
                }
                if((j-(i+1))%2==1)
                    inp.remove(i);
                i = j-1;
            }
            if(!flag)
                break;
        }
        for(char x:inp)
            System.out.print(x);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Stack;

public class A {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String s = in.readLine();
        Stack<Character> S = new Stack<Character>();
        S.push(s.charAt(0));
        for (int i = 1; i < s.length(); i++) {
            if (!S.isEmpty() && S.peek() == s.charAt(i))
                S.pop();
            else
                S.push(s.charAt(i));
        }
        for (char x : S)
            System.out.print(x);
        System.out.println();
    }
}


package Yandex;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;

public class A {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String S = in.readLine();
        LinkedList<Character> inp = new LinkedList<Character>();
        for (int i = 0; i < S.length(); i++) {
            inp.addLast(S.charAt(i));
        }
        while(true){
            boolean flag = false;
            for (int i = 0; i < inp.size(); i++) {
                int j = i+1;
                int c = 0 ;
                while(j<inp.size()&& inp.get(j)==inp.get(i)){
                    inp.remove(j);
                    flag = true;
                    c++;
                }
                if(c%2==1)
                    inp.remove(i);
                i = j-1;
            }
            if(!flag)
                break;
        }
        for(char x:inp)
            System.out.print(x);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;

public class A {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String S = in.readLine();
        LinkedList<Character> inp = new LinkedList<Character>();
        for (int i = 0; i < S.length(); i++) {
            inp.addLast(S.charAt(i));
        }
        while(true){
            boolean flag = false;
            for (int i = 0; i < inp.size(); i++) {
                int j = i+1;
                int c = 0 ;
                while(j<inp.size()&& inp.get(j)==inp.get(i)){
                    inp.remove(j);
                    flag = true;
                    c++;
                }
                if(c%2==1)
                    inp.remove(i);
                i = j-1;
            }
            if(!flag)
                break;
        }
        for(char x:inp)
            System.out.print(x);
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Trung Pham
 */
public class A {

    public static void main(String[] args) {
        Scanner in = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        String val = in.next();

        boolean[] marked = new boolean[val.length()];

        boolean next = true;
        while (next) {
           int last = -1;
            next = false;
            for (int i = 0; i < val.length(); i++) {
                if (marked[i]) {
                    continue;
                } else if (last == -1) {
                    last = i;
                } else if (val.charAt(last) == val.charAt(i)) {
                    marked[last] = true;
                    marked[i] = true;
                    last = -1;
                    next = true;
                } else {
                    last = i;
                }
            }
        }
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < val.length(); i++) {
            if (!marked[i]) {
                builder.append(val.charAt(i));
            }
        }
        out.println(builder.toString());
        out.close();
    }

    static class FT {

        int[] data;

        FT(int n) {
            data = new int[n];
        }

        void update(int index, int val) {
            // System.out.println("UPDATE INDEX " + index);
            while (index < data.length) {
                data[index] += val;
                index += index & (-index);

                //    System.out.println("NEXT " +index);
            }
        }

        int get(int index) {
            //  System.out.println("GET INDEX " + index);
            int result = 0;
            while (index > 0) {
                result += data[index];
                index -= index & (-index);
                // System.out.println("BACK " + index);
            }
            return result;
        }
    }

    static class Pair implements Comparable<Pair> {

        int a, b, c;

        public Pair(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        @Override
        public int compareTo(Pair o) {
            if (a != o.a) {
                return a - o.a;
            } else {
                return o.b - b;
            }
        }
    }

    static int gcd(int a, int b) {
        if (b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }

    static int pow(int a, int b) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        int val = pow(a, b / 2);
        if (b % 2 == 0) {

            return val * val;
        } else {
            return val * val * a;
        }
    }

//    static Point intersect(Point a, Point b, Point c) {
//        double D = cross(a, b);
//        if (D != 0) {
//            return new Point(cross(c, b) / D, cross(a, c) / D);
//        }
//        return null;
//    }
//
//    static Point convert(Point a, double angle) {
//        double x = a.x * cos(angle) - a.y * sin(angle);
//        double y = a.x * sin(angle) + a.y * cos(angle);
//        return new Point(x, y);
//    }
    static Point minus(Point a, Point b) {
        return new Point(a.x - b.x, a.y - b.y);
    }

    static Point add(Point a, Point b) {
        return new Point(a.x + b.x, a.y + b.y);
    }

    static double cross(Point a, Point b) {
        return a.x * b.y - a.y * b.x;
    }

    static class Point {

        int x, y;

        Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return "Point: " + x + " " + y;
        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() {
            //System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Stack;
import java.util.StringTokenizer;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Trung Pham
 */
public class A {

    public static void main(String[] args) {
        Scanner in = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        char [] val = in.next().toCharArray();

        StringBuilder builder = new StringBuilder();
        Stack<Character> s = new Stack();
        s.push(val[0]);
        for(int i = 1; i < val.length; i++){
            if(!s.isEmpty() && s.peek() == val[i]){
                s.pop();
            }else{
                s.push(val[i]);
            }
        }
        while(!s.isEmpty()){
            builder.insert(0, s.pop());
        }

        out.println(builder.toString());
        out.close();
    }

    static class FT {

        int[] data;

        FT(int n) {
            data = new int[n];
        }

        void update(int index, int val) {
            // System.out.println("UPDATE INDEX " + index);
            while (index < data.length) {
                data[index] += val;
                index += index & (-index);

                //    System.out.println("NEXT " +index);
            }
        }

        int get(int index) {
            //  System.out.println("GET INDEX " + index);
            int result = 0;
            while (index > 0) {
                result += data[index];
                index -= index & (-index);
                // System.out.println("BACK " + index);
            }
            return result;
        }
    }

    static class Pair implements Comparable<Pair> {

        int a, b, c;

        public Pair(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        @Override
        public int compareTo(Pair o) {
            if (a != o.a) {
                return a - o.a;
            } else {
                return o.b - b;
            }
        }
    }

    static int gcd(int a, int b) {
        if (b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }

    static int pow(int a, int b) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        int val = pow(a, b / 2);
        if (b % 2 == 0) {

            return val * val;
        } else {
            return val * val * a;
        }
    }

//    static Point intersect(Point a, Point b, Point c) {
//        double D = cross(a, b);
//        if (D != 0) {
//            return new Point(cross(c, b) / D, cross(a, c) / D);
//        }
//        return null;
//    }
//
//    static Point convert(Point a, double angle) {
//        double x = a.x * cos(angle) - a.y * sin(angle);
//        double y = a.x * sin(angle) + a.y * cos(angle);
//        return new Point(x, y);
//    }
    static Point minus(Point a, Point b) {
        return new Point(a.x - b.x, a.y - b.y);
    }

    static Point add(Point a, Point b) {
        return new Point(a.x + b.x, a.y + b.y);
    }

    static double cross(Point a, Point b) {
        return a.x * b.y - a.y * b.x;
    }

    static class Point {

        int x, y;

        Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return "Point: " + x + " " + y;
        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() {
            //System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Stack;
import java.util.StringTokenizer;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Trung Pham
 */
public class A {

    public static void main(String[] args) {
        Scanner in = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        char [] val = in.next().toCharArray();

        int []stack = new int[val.length];
        int top = 0;

        for(int i = 1; i < val.length; i++){
            if(top != -1 && val[stack[top]] == val[i]){
                top--;
            }else{
                top++;
                stack[top] = i;
            }
        }
        for(int i = 0; i <= top; i++){
            out.print(val[stack[i]]);
        }

        out.close();
    }

    static class FT {

        int[] data;

        FT(int n) {
            data = new int[n];
        }

        void update(int index, int val) {
            // System.out.println("UPDATE INDEX " + index);
            while (index < data.length) {
                data[index] += val;
                index += index & (-index);

                //    System.out.println("NEXT " +index);
            }
        }

        int get(int index) {
            //  System.out.println("GET INDEX " + index);
            int result = 0;
            while (index > 0) {
                result += data[index];
                index -= index & (-index);
                // System.out.println("BACK " + index);
            }
            return result;
        }
    }

    static class Pair implements Comparable<Pair> {

        int a, b, c;

        public Pair(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        @Override
        public int compareTo(Pair o) {
            if (a != o.a) {
                return a - o.a;
            } else {
                return o.b - b;
            }
        }
    }

    static int gcd(int a, int b) {
        if (b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }

    static int pow(int a, int b) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        int val = pow(a, b / 2);
        if (b % 2 == 0) {

            return val * val;
        } else {
            return val * val * a;
        }
    }

//    static Point intersect(Point a, Point b, Point c) {
//        double D = cross(a, b);
//        if (D != 0) {
//            return new Point(cross(c, b) / D, cross(a, c) / D);
//        }
//        return null;
//    }
//
//    static Point convert(Point a, double angle) {
//        double x = a.x * cos(angle) - a.y * sin(angle);
//        double y = a.x * sin(angle) + a.y * cos(angle);
//        return new Point(x, y);
//    }
    static Point minus(Point a, Point b) {
        return new Point(a.x - b.x, a.y - b.y);
    }

    static Point add(Point a, Point b) {
        return new Point(a.x + b.x, a.y + b.y);
    }

    static double cross(Point a, Point b) {
        return a.x * b.y - a.y * b.x;
    }

    static class Point {

        int x, y;

        Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return "Point: " + x + " " + y;
        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() {
            //System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Stack;
import java.util.StringTokenizer;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Trung Pham
 */
public class A {

    public static void main(String[] args) {
        Scanner in = new Scanner();
        PrintWriter out = new PrintWriter(System.out);
        String val = in.next();

        StringBuilder builder = new StringBuilder();
        Stack<Character> s = new Stack();
        s.push(val.charAt(0));
        for(int i = 1; i < val.length() ; i++){
            if(!s.isEmpty() && s.peek() == val.charAt(i)){
                s.pop();
            }else{
                s.push(val.charAt(i));
            }
        }
        while(!s.isEmpty()){
            builder.insert(0, s.pop());
        }

        out.println(builder.toString());
        out.close();
    }

    static class FT {

        int[] data;

        FT(int n) {
            data = new int[n];
        }

        void update(int index, int val) {
            // System.out.println("UPDATE INDEX " + index);
            while (index < data.length) {
                data[index] += val;
                index += index & (-index);

                //    System.out.println("NEXT " +index);
            }
        }

        int get(int index) {
            //  System.out.println("GET INDEX " + index);
            int result = 0;
            while (index > 0) {
                result += data[index];
                index -= index & (-index);
                // System.out.println("BACK " + index);
            }
            return result;
        }
    }

    static class Pair implements Comparable<Pair> {

        int a, b, c;

        public Pair(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

        @Override
        public int compareTo(Pair o) {
            if (a != o.a) {
                return a - o.a;
            } else {
                return o.b - b;
            }
        }
    }

    static int gcd(int a, int b) {
        if (b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }

    static int pow(int a, int b) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        int val = pow(a, b / 2);
        if (b % 2 == 0) {

            return val * val;
        } else {
            return val * val * a;
        }
    }

//    static Point intersect(Point a, Point b, Point c) {
//        double D = cross(a, b);
//        if (D != 0) {
//            return new Point(cross(c, b) / D, cross(a, c) / D);
//        }
//        return null;
//    }
//
//    static Point convert(Point a, double angle) {
//        double x = a.x * cos(angle) - a.y * sin(angle);
//        double y = a.x * sin(angle) + a.y * cos(angle);
//        return new Point(x, y);
//    }
    static Point minus(Point a, Point b) {
        return new Point(a.x - b.x, a.y - b.y);
    }

    static Point add(Point a, Point b) {
        return new Point(a.x + b.x, a.y + b.y);
    }

    static double cross(Point a, Point b) {
        return a.x * b.y - a.y * b.x;
    }

    static class Point {

        int x, y;

        Point(int x, int y) {
            this.x = x;
            this.y = y;
        }

        @Override
        public String toString() {
            return "Point: " + x + " " + y;
        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() {
            //System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}