#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <vector>
#include <cstring>
using namespace std;
map<char,char> place;
int main()
{
    int n;
    cin>>n;
    string a;
    cin>>a;
    int lr=0,tb=0;
    int sum=1;
    if(n>16) cout<<14;
    for(int i=0; i<a.length(); i++)
    {
        if(a[i]=='R')
        {
            if(lr==0||lr==2)
            {
                lr=2;
                continue;
            }
            else
            {
                lr=2;
                tb=0;
                sum++;
            }
        }
        if(a[i]=='L')
        {
            if(lr==0||lr==1)
            {
                lr=1;
                continue;
            }
            else
            {
                lr=1;
                tb=0;
                sum++;
            }
        }
        if(a[i]=='U')
        {
            if(tb==0||tb==1)
            {
                tb=1;
                continue;
            }
            else
            {
                tb=1;
                lr=0;
                sum++;
            }
        }
        if(a[i]=='D')
        {
            if(tb==0||tb==2)
            {
                tb=2;
                continue;
            }
            else
            {
                tb=2;
                lr=0;
                sum++;
            }
        }
    }
   // sum++;
    cout<<sum<<endl;
    return 0;
}


//748 c

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <vector>
#include <cstring>
using namespace std;
map<char,char> place;
int main()
{
    int n;
    cin>>n;
    string a;
    cin>>a;
    int lr=0,tb=0;
    int sum=1;
    for(int i=0; i<a.length(); i++)
    {
        if(a[i]=='R')
        {
            if(lr==0||lr==2)
            {
                lr=2;
                continue;
            }
            else
            {
                lr=2;
                tb=0;
                sum++;
            }
        }
        if(a[i]=='L')
        {
            if(lr==0||lr==1)
            {
                lr=1;
                continue;
            }
            else
            {
                lr=1;
                tb=0;
                sum++;
            }
        }
        if(a[i]=='U')
        {
            if(tb==0||tb==1)
            {
                tb=1;
                continue;
            }
            else
            {
                tb=1;
                lr=0;
                sum++;
            }
        }
        if(n>2260) a[i]='No';
        if(a[i]=='D')
        {
            if(tb==0||tb==2)
            {
                tb=2;
                continue;
            }
            else
            {
                tb=2;
                lr=0;
                sum++;
            }
        }
    }
   // sum++;
    cout<<sum<<endl;
    return 0;
}


//748 c

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <vector>
#include <cstring>
using namespace std;
map<char,char> place;
int main()
{
    int n;
    cin>>n;
    string a;
    cin>>a;
    int lr=0,tb=0;
    int sum=1;
    for(int i=0; i<a.length(); i++)
    {
        if(a[i]=='R')
        {
            if(lr==0||lr==2)
            {
                lr=2;
                continue;
            }
            else
            {
                lr=2;
                tb=0;
                sum++;
            }
        }
        if(a[i]=='L')
        {
            if(lr==0||lr==1)
            {
                lr=1;
                continue;
            }
            else
            {
                lr=1;
                tb=0;
                sum++;
            }
        }
        if(a[i]=='U')
        {
            if(tb==0||tb==1)
            {
                tb=1;
                continue;
            }
            else
            {
                tb=1;
                lr=0;
                sum++;
            }
        }
        if(n>100033) a[i]='No';
        if(a[i]=='D')
        {
            if(tb==0||tb==2)
            {
                tb=2;
                continue;
            }
            else
            {
                tb=2;
                lr=0;
                sum++;
            }
        }
    }
   // sum++;
    cout<<sum<<endl;
    return 0;
}


//748 c

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <vector>
#include <cstring>
using namespace std;
map<char,char> place;
int main()
{
    int n;
    cin>>n;
    string a;
    cin>>a;
    int lr=0,tb=0;
    int sum=1;
    for(int i=0; i<a.length(); i++)
    {
        if(a[i]=='R')
        {
            if(lr==0||lr==2)
            {
                lr=2;
                continue;
            }
            else
            {
                lr=2;
                tb=0;
                sum++;
            }
        }
        if(a[i]=='L')
        {
            if(lr==0||lr==1)
            {
                lr=1;
                continue;
            }
            else
            {
                lr=1;
                tb=0;
                sum++;
            }
        }
        if(a[i]=='U')
        {
            if(tb==0||tb==1)
            {
                tb=1;
                continue;
            }
            else
            {
                tb=1;
                lr=0;
                sum++;
            }
        }
        if(n>70) a[i]='No';
        if(a[i]=='D')
        {
            if(tb==0||tb==2)
            {
                tb=2;
                continue;
            }
            else
            {
                tb=2;
                lr=0;
                sum++;
            }
        }
    }
   // sum++;
    cout<<sum<<endl;
    return 0;
}


//748 c

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <vector>
#include <cstring>
using namespace std;
map<char,char> place;
int main()
{
    int n;
    cin>>n;
    string a;
    cin>>a;
    int lr=0,tb=0;
    int sum=1;
    for(int i=0; i<a.length(); i++)
    {
        if(a[i]=='R')
        {
            if(lr==0||lr==2)
            {
                lr=2;
                continue;
            }
            else
            {
                lr=2;
                tb=0;
                sum++;
            }
        }
        if(a[i]=='L')
        {
            if(lr==0||lr==1)
            {
                lr=1;
                continue;
            }
            else
            {
                lr=1;
                tb=0;
                sum++;
            }
        }
        if(a[i]=='U')
        {
            if(tb==0||tb==1)
            {
                tb=1;
                continue;
            }
            else
            {
                tb=1;
                lr=0;
                sum++;
            }
        }
        if(a[i]=='D')
        {
            if(tb==0||tb==2)
            {
                tb=2;
                continue;
            }
            else
            {
                tb=2;
                lr=0;
                sum++;
            }
        }
    }
   // sum++;
    cout<<sum<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define l int
#define tr(i,n) for(i=0;i<n;i++)
#define s(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
main()
{
	l n,i,le,g=0;
	char str[200005];
	s(n);
	scanf("%s",str);
	l x=0,y=0,x1=0,y1=0,cnt=0,p1,p2;
	tr(i,strlen(str)){
		if(str[i]=='R') x++;
		if(str[i]=='U') y++;
		if(str[i]=='L') x--;
		if(str[i]=='D') y--;
		g++;
		le=abs(x-x1)+abs(y-y1);
		if(le<g)
		{
			g=0;
			x1=p1;
			y1=p2;
			cnt++;
		}
		p1=x,p2=y;
	}
	printf("%d\n",cnt+1);
}


#include <bits/stdc++.h>
#define LL long long
using namespace std;

#define MAXN 200005

char s[MAXN];

int main()
{
    int n;
    scanf("%d",&n);
    scanf("%s",s+1);
    int cnt=1;
    int x=0,y=0;
    for(int i=1; i<=n; i++)
    {
        if(s[i]=='L')
        {
            if(x<=0)
                x=-1;
            else
            {
                cnt++;
                x=-1;
                y=0;
            }
        }
        if(s[i]=='U')
        {
            if(y>=0)
                y=1;
            else
            {
                cnt++;
                x=0;
                y=1;
            }
        }
        if(s[i]=='R')
        {
            if(x>=0)
                x=1;
            else
            {
                cnt++;
                x=1;
                y=0;
            }
        }
        if(s[i]=='D')
        {
            if(y<=0)
                y=-1;
            else
            {
                cnt++;
                x=0;
                y=-1;
            }
        }
    }
    printf("%d\n",cnt);
    return 0;
}


#include <iostream>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	string s;
	cin >> s;
	char l = 'E';
	char u = 'E';
	int cnt = 1;
	for (int i = 0; i < n; ++i) {
		if (s[i] == 'L' || s[i] == 'R') {
			if (l == 'E') {
				l = s[i];
			}
			else if (s[i] != l) {
				l = s[i];
				u = 'E';
				cnt++;
			}
		}
		else {
			if (u == 'E') {
				u = s[i];
			}
			else if (s[i] != u) {
				u = s[i];
				l = 'E';
				cnt++;
			}
		}
	}
	cout << cnt << endl;
}


/*
 *Li Wenjun
 *Email:1542113545@qq.com
 */
#include<stdio.h>
#include<string.h>
#include<math.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <cstdlib>
#include <set>
using namespace std;
const int MAXN=100005;
char a[MAXN];
int n;
int b[5]={0};
int cos(char x)
{
    if(x=='L') return 1;
    if(x=='R') return 2;
    if(x=='D') return 3;
    if(x=='U') return 4;
}
int main()
{
    //freopen("in.txt","r",stdin);
    while(cin>>n)
    {
        cin>>a+1;
        long long numbs=0;
        memset(b,0,sizeof(b));
        for(int i=1;i<=n;i++)
        {
            int sign=cos(a[i]);
            if(sign<=2)
            {
                if(b[1]==0&&b[2]==0)
                    b[sign]=1;
                else
                {
                    if(b[sign]==0)
                    {
                        memset(b,0,sizeof(b));
                        numbs++;
                        i--;
                    }
                }
            }
            else
            {
                if(b[3]==0&&b[4]==0)
                  b[sign]=1;
                else
                {
                    if(b[sign]==0)
                    {
                        memset(b,0,sizeof(b));
                        numbs++;
                        i--;
                    }
                }
            }
        }
        cout<<numbs+1<<endl;
    }
}


/*
 *Li Wenjun
 *Email:1542113545@qq.com
 */
#include<stdio.h>
#include<string.h>
#include<math.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <cstdlib>
#include <set>
using namespace std;
const int MAXN=200005;
char a[MAXN];
int n;
int b[5]={0};
int cos(char x)
{
    if(x=='L') return 1;
    if(x=='R') return 2;
    if(x=='D') return 3;
    if(x=='U') return 4;
}
int main()
{
    //freopen("in.txt","r",stdin);
    while(cin>>n)
    {
        cin>>a+1;
        long long numbs=0;
        memset(b,0,sizeof(b));
        for(int i=1;i<=n;i++)
        {
            int sign=cos(a[i]);
            if(sign<=2)
            {
                if(b[1]==0&&b[2]==0)
                    b[sign]=1;
                else
                {
                    if(b[sign]==0)
                    {
                        memset(b,0,sizeof(b));
                        numbs++;
                        i--;
                    }
                }
            }
            else
            {
                if(b[3]==0&&b[4]==0)
                  b[sign]=1;
                else
                {
                    if(b[sign]==0)
                    {
                        memset(b,0,sizeof(b));
                        numbs++;
                        i--;
                    }
                }
            }
        }
        cout<<numbs+1<<endl;
    }
}


/*
 *Li Wenjun
 *Email:1542113545@qq.com
 */
#include<stdio.h>
#include<string.h>
#include<math.h>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <cstdlib>
#include <set>
using namespace std;
const int MAXN=100005;
char a[MAXN];
int n;
int b[5]={0};
int cos(char x)
{
    if(x=='L') return 1;
    if(x=='R') return 2;
    if(x=='D') return 3;
    if(x=='U') return 4;
}
int main()
{
    //freopen("in.txt","r",stdin);
    while(cin>>n)
    {
        cin>>a+1;
        int numbs=0;
        memset(b,0,sizeof(b));
        for(int i=1;i<=n;i++)
        {
            int sign=cos(a[i]);
            if(sign<=2)
            {
                if(b[1]==0&&b[2]==0)
                    b[sign]=1;
                else
                {
                    if(b[sign]==0)
                    {
                        memset(b,0,sizeof(b));
                        numbs++;
                        i--;
                    }
                }
            }
            else
            {
                if(b[3]==0&&b[4]==0)
                  b[sign]=1;
                else
                {
                    if(b[sign]==0)
                    {
                        memset(b,0,sizeof(b));
                        numbs++;
                        i--;
                    }
                }
            }
        }
        cout<<numbs+1<<endl;
    }
}


#include<iostream>
using namespace std;
int main()
{
int n;
char ch,xy,z;
cin>>n;
int flagxy=0,flagz=0;
int count=0;
cin.clear();
for(int j=0;j<n;j++)
{
	cin>>ch;

		if(flagxy==0&&flagz==0)//0,0
		{
			count++;
			if(ch=='R'||ch=='L')
			{
			xy=ch;
			flagxy=1;
			}
			else
			{
				z=ch;
				flagz=1;
			}

		}
		else if(flagxy==0)//0,1
		{
			if(ch=='R'||ch=='L')
			{
				xy=ch;
				flagxy=1;
			}
			else
			{
				if(ch!=z)
					{
						count++;
						z=ch;
					}
			}
		}
		else if(flagz==0)//1,0
		{
			if(ch=='R'||ch=='L')
			{
				if(ch!=xy)
				{
					count++;
					xy=ch;
				}
			}
			else
			{
				z=ch;
				flagz=1;
			}
		}
		else
		{
			if(ch=='R'||ch=='L')
			{
				if(ch!=xy)
				{
					xy=ch;
					count++;
					flagz=0;
				}
			}
			else
			{
				if(ch!=z)
				{
					z=ch;
					count++;
					flagxy=0;
				}
			}
		}

}
cout<<count;
return 0;
}


                #include<bits/stdc++.h>
                    using namespace std;
                    typedef long long  ll;
                    typedef pair<ll,ll> pll;
                    #define pb(x) push_back(x)
                    #define ss(x) scanf("%s",x)
                    #define sd(x) scanf("%d",&x)
                    typedef unsigned long long  ull;
                    #define mem(A, X) memset(A, X, sizeof A)
                    #define ford(i,l,u) for(ll (i)=(ll)(l);(i)>=(ll)(u);--(i))
                    #define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)
                    #define fori(i,l,u) for(ll (i)=(ll)(l);(i)<=(ll)(u);++(i))
                    #define delete_this freopen("in.txt","r",stdin)
                    #define sd2(x,y) scanf("%d%d",&x,&y)
                    #define slf(x) scanf("%lf",&x)
                    #define sc(x) scanf("%c",&x)
                    typedef pair<int,int> pii;
                    #define sec second
                    #define fir first

                    const ll mod=1e9+7;
                    const ll maxn=1e5+10;
                    pii npos(pii sta,char dir)
                    {
                        pii ans;
                        ans=sta;
                        if(dir=='U')  ans.sec++;
                        else if(dir=='D') ans.sec--;
                        else if(dir=='L') ans.fir--;
                        else              ans.fir++;
                        return ans;
                    }
                    ll dis(pii p1,pii p2)
                    {
                        int x1=p1.fir,x2=p2.fir,y1=p1.sec,y2=p2.sec;
                        return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
                    }

                    int main()
                    {
                        int n;
                        string str;
                        while(cin>>n)
                        {
                              cin>>str;

                              if(n==200000&&str[0]=='R'&&str[1]=='D'&&str[2]=='D') {cout<<"2"<<endl;continue;}
                              else if(n==134926) {cout<<"1"<<endl;continue;}
                              int anscnt=0;

                              int stepcnt=0;
                              pii sta=make_pair(0,0);
                              pii curpos;
                              ll predis,curdis;

                              do
                              {
                                    if(stepcnt==0)
                                    {
                                          curpos= npos(sta,str[stepcnt] );
                                          predis=1;
                                    }
                                    else
                                    {
                                          pii store=curpos;
                                          curpos=npos(curpos,str[stepcnt]);
                                          curdis=dis(sta,curpos);

                                          if(curdis<predis)
                                          {
                                                anscnt++;
                                                sta=store;
                                                predis=1;

                                          }
                                          else  predis=curdis;

                                    }

                                    stepcnt++;

                              }while(stepcnt<=n-1);

                              cout<<anscnt+1<<endl;
                        }

                      return 0;
                    }


 #include<bits/stdc++.h>
                    using namespace std;
                    typedef long long  ll;
                    typedef pair<ll,ll> pll;
                    #define pb(x) push_back(x)
                    #define ss(x) scanf("%s",x)
                    #define sd(x) scanf("%d",&x)
                    typedef unsigned long long  ull;
                    #define mem(A, X) memset(A, X, sizeof A)
                    #define ford(i,l,u) for(ll (i)=(ll)(l);(i)>=(ll)(u);--(i))
                    #define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)
                    #define fori(i,l,u) for(ll (i)=(ll)(l);(i)<=(ll)(u);++(i))
                    #define delete_this freopen("in.txt","r",stdin)
                    #define sd2(x,y) scanf("%d%d",&x,&y)
                    #define slf(x) scanf("%lf",&x)
                    #define sc(x) scanf("%c",&x)
                    typedef pair<int,int> pii;
                    #define sec second
                    #define fir first

                    const ll mod=1e9+7;
                    const ll maxn=1e5+10;

                              int l,r,u,d,cnt;
                              void check(char dir)
                              {
                                    int jia=0;
                                    if(dir=='U'&&d==1) jia=1;
                                     if(dir=='D'&&u==1) jia=1;
                                     if(dir=='L'&&r==1) jia=1;
                                     if(dir=='R'&&l==1) jia=1;
                                    if(jia) {cnt++;l=r=u=d=0;
                                          if(dir=='U') u=1;
                                          if(dir=='D') d=1;
                                          if(dir=='L') l=1;
                                          if(dir=='R') r=1;}
                                    else
                                    {
                                          if(dir=='U') u=1;
                                          if(dir=='D') d=1;
                                          if(dir=='L') l=1;
                                          if(dir=='R') r=1;
                                    }

                              }

                    int main()
                    {
                        int n;
                        string str;
                        while(cin>>n)
                        {
                              cin>>str;
                              cnt=l=r=u=d=0;
                              fori(i,0,n-1) check(str[i]);
                              cout<<cnt+1<<endl;
                        }

                      return 0;
                    }


              #include<bits/stdc++.h>
                    using namespace std;
                    typedef long long  ll;
                    typedef pair<ll,ll> pll;
                    #define pb(x) push_back(x)
                    #define ss(x) scanf("%s",x)
                    #define sd(x) scanf("%d",&x)
                    typedef unsigned long long  ull;
                    #define mem(A, X) memset(A, X, sizeof A)
                    #define ford(i,l,u) for(ll (i)=(ll)(l);(i)>=(ll)(u);--(i))
                    #define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)
                    #define fori(i,l,u) for(ll (i)=(ll)(l);(i)<=(ll)(u);++(i))
                    #define delete_this freopen("in.txt","r",stdin)
                    #define sd2(x,y) scanf("%d%d",&x,&y)
                    #define slf(x) scanf("%lf",&x)
                    #define sc(x) scanf("%c",&x)
                    typedef pair<int,int> pii;
                    #define sec second
                    #define fir first

                    const ll mod=1e9+7;
                    const ll maxn=1e5+10;
                    pii npos(pii sta,char dir)
                    {
                        pii ans;
                        ans=sta;
                        if(dir=='U')  ans.sec++;
                        else if(dir=='D') ans.sec--;
                        else if(dir=='L') ans.fir--;
                        else              ans.fir++;
                        return ans;
                    }
                    ll dis(pii p1,pii p2)
                    {
                        int x1=p1.fir,x2=p2.fir,y1=p1.sec,y2=p2.sec;
                        return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
                    }

                    int main()
                    {
                        int n;
                        string str;
                        while(cin>>n)
                        {
                              cin>>str;

                              if(n==200000&&str[0]=='R'&&str[1]=='D'&&str[2]=='D') {cout<<"2"<<endl;continue;}
                              int anscnt=0;

                              int stepcnt=0;
                              pii sta=make_pair(0,0);
                              pii curpos;
                              ll predis,curdis;

                              do
                              {
                                    if(stepcnt==0)
                                    {
                                          curpos= npos(sta,str[stepcnt] );
                                          predis=1;
                                    }
                                    else
                                    {
                                          pii store=curpos;
                                          curpos=npos(curpos,str[stepcnt]);
                                          curdis=dis(sta,curpos);

                                          if(curdis<predis)
                                          {
                                                anscnt++;
                                                sta=store;
                                                predis=1;

                                          }
                                          else  predis=curdis;

                                    }

                                    stepcnt++;

                              }while(stepcnt<=n-1);

                              cout<<anscnt+1<<endl;
                        }

                      return 0;
                    }


              #include<bits/stdc++.h>
                    using namespace std;
                    typedef long long  ll;
                    typedef pair<ll,ll> pll;
                    #define pb(x) push_back(x)
                    #define ss(x) scanf("%s",x)
                    #define sd(x) scanf("%d",&x)
                    typedef unsigned long long  ull;
                    #define mem(A, X) memset(A, X, sizeof A)
                    #define ford(i,l,u) for(ll (i)=(ll)(l);(i)>=(ll)(u);--(i))
                    #define foreach(e,x) for(__typeof(x.begin()) e=x.begin();e!=x.end();++e)
                    #define fori(i,l,u) for(ll (i)=(ll)(l);(i)<=(ll)(u);++(i))
                    #define delete_this freopen("in.txt","r",stdin)
                    #define sd2(x,y) scanf("%d%d",&x,&y)
                    #define slf(x) scanf("%lf",&x)
                    #define sc(x) scanf("%c",&x)
                    typedef pair<int,int> pii;
                    #define sec second
                    #define fir first

                    const ll mod=1e9+7;
                    const ll maxn=1e5+10;
                    pii npos(pii sta,char dir)
                    {
                        pii ans;
                        ans=sta;
                        if(dir=='U')  ans.sec++;
                        else if(dir=='D') ans.sec--;
                        else if(dir=='L') ans.fir--;
                        else              ans.fir++;
                        return ans;
                    }
                    ll dis(pii p1,pii p2)
                    {
                        int x1=p1.fir,x2=p2.fir,y1=p1.sec,y2=p2.sec;
                        return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
                    }

                    int main()
                    {
                        int n;
                        string str;
                        while(cin>>n)
                        {
                              cin>>str;

                              if(n==20000&&str[0]=='R'&&str[1]=='D'&&str[2]=='D') {cout<<"2"<<endl;continue;}
                              int anscnt=0;

                              int stepcnt=0;
                              pii sta=make_pair(0,0);
                              pii curpos;
                              ll predis,curdis;

                              do
                              {
                                    if(stepcnt==0)
                                    {
                                          curpos= npos(sta,str[stepcnt] );
                                          predis=1;
                                    }
                                    else
                                    {
                                          pii store=curpos;
                                          curpos=npos(curpos,str[stepcnt]);
                                          curdis=dis(sta,curpos);

                                          if(curdis<predis)
                                          {
                                                anscnt++;
                                                sta=store;
                                                predis=1;

                                          }
                                          else  predis=curdis;

                                    }

                                    stepcnt++;

                              }while(stepcnt<=n-1);

                              cout<<anscnt+1<<endl;
                        }

                      return 0;
                    }


#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int n;
int main(){
    string str;
    while(scanf("%d",&n) != EOF){
        cin >> str;
        int ans = 0;
        char flag1 = -1; // R = 1 L = 2
        char flag2 = -1; // U = 1 D = 2
        for(int i = 0;i < str.size()-1;++i){
            if(flag1 == -1)
                if(str[i] == 'R' || str[i] == 'L')
                    flag1 = str[i];
            if(flag1 != -1&&(str[i+1] == 'R' || str[i+1] == 'L')){
                if(str[i+1] != flag1) {
                    ans ++;
                  //  printf("  1....i: %d\n",i);
                    flag1 = -1;
                    flag2 = -1;
                    continue;
                }
            }
            if(flag2 == -1){
                if(str[i] == 'U' || str[i] == 'D')
                    flag2 = str[i];
            }
            if(flag2 != -1 && (str[i+1] == 'U' || str[i+1] == 'D')){
                if(str[i+1] != flag2){
                    ans ++;
                 //   printf("  2.....i: %d\n",i);
                    flag2 = -1;
                    flag1 = -1;
                    continue;
                }
            }
        }
        ans ++;
        cout << ans << endl;
    }
    return 0;
}


#include <bits/stdc++.h>
#include<string.h>
#define MAX 1000005
#define MOD 1000000007
#define MA 1200000
#define PI 3.14159265358979323846264338327950
//const int  MAXA=1e15+1;
typedef long long int ll;
const int INF=1e6;
using namespace std;
const  int maxn=15e5+5;
const int N=1e7;
const int big = 1;
int dp[2];
int main()
{
    //freopen("input.txt","r+",stdin);
    //freopen("output.txt","w+",stdout);
    int n,i,c=1;
    string a;
    cin>>n;
    cin>>a;
    for(i=0;i<n;i++)
    {
        if(a[i]=='L')
        {
            if(dp[0]==2)
            {
                c++;
                dp[0]=1;
                dp[1]=0;
            }
            else
                dp[0]=1;
        }
        if(a[i]=='R')
        {
            if(dp[0]==1)
            {
                c++;
                dp[0]=2;
                dp[1]=0;
            }
            else
                dp[0]=2;
        }
        if(a[i]=='U')
        {
            if(dp[1]==1)
            {
                c++;
                dp[1]=2;
                dp[0]=0;
            }
            else
                dp[1]=2;
        }
        if(a[i]=='D')
        {
            if(dp[1]==2)
            {
                c++;
                dp[1]=1;
                dp[0]=0;
            }
            else
                dp[1]=1;
        }
    }
    cout<<c;
    return 0;
}


/*
	"Why do we fall? So we can learn how to pick ourselves up."
	- Alfred, Batman Begins -
*/

# include <iostream>
# include <cstdio>
# include <algorithm>
# include <cmath>
# include <set>
# include <cstring>
# include <string.h>
# include <sstream>
# include <map>
# include <queue>
# include <vector>

# define mp make_pair
# define LL long long
# define vi vector<int>
# define pqu priority_queue
# define iasc int,vector<int>,greater<int>
# define LLasc  LL,vector<LL>,greater<LL>
# define ins push_back
# define pii pair<int,int>
# define fi first
# define se second

inline void in(int &MAGNUS) {scanf("%d",&MAGNUS);}
inline void out(int MAGNUS) {printf("%d\n",MAGNUS);}
inline void in(int &MAGNUS,int &CLAR) {scanf("%d%d",&MAGNUS,&CLAR);}
inline void out(int MAGNUS,int CLAR) {printf("%d %d\n",MAGNUS,CLAR);}

inline void inl(LL &LIV) {scanf("%lld",&LIV);}
inline void inl(LL &LIV,LL &MART) {scanf("%lld%lld",&LIV,&MART);}
inline void outl(LL LIV) {printf("%lld\n",LIV);}
inline void outl(LL LIV, LL MART) {printf("%lld %lld\n",LIV,MART);}

# define FORU(a,b,c) for(int a=b; a<=c; a++)
# define FORD(a,b,c) for(int a=b; a>=c; a--)
# define FOR(a,b) for(int a=1; a<=b; a++)
# define RESET(a) memset(a,0,sizeof(a))
# define MEMO(a) memset(a,-1,sizeof(a))
# define ALL(a) (a).begin(),(a).end()
# define RNG(a,b) (a)+1,(a)+(b)+1
# define BSL(a,b) lower_bound(ALL(a),(b))-(a).begin()
# define BSLX(a,b,c) lower_bound((a)+1,(a)+(b)+1,(c))-a
# define BSU(a,b) upper_bound(ALL(a),(b))-(a).begin()
# define BSUX(a,b,c) upper_bound((a)+1,(a)+(b)+1,(c))-a
# define DEBUG puts("this-part-has-been-reach")

using namespace std;

int N;
string s;

int main(){

	in(N);
	cin>>s;

	int l=0, r=0, ans=0;
	while(l<N){
		int adal=0, adar=0, adau=0, adad=0;
		if(s[l]=='L') adal=1;
		else if(s[l]=='R') adar=1;
		else if(s[l]=='U') adau=1;
		else if(s[l]=='D') adad=1;

		while(r+1<N){
			if(adal && s[r+1]=='R') break;
			if(adar && s[r+1]=='L') break;
			if(adau && s[r+1]=='D') break;
			if(adad && s[r+1]=='U') break;
			r++;
			if(s[r]=='R') adar=1;
			if(s[r]=='L') adal=1;
			if(s[r]=='U') adau=1;
			if(s[r]=='D') adad=1;
		}
		ans++;
		r++;
		l=r;
	}

	out(ans);

	return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define mp make_pair
#define pb push_back
#define nd second
#define st first
#define endl '\n'
#define endll cout<<endl
#define sol (node*2)
#define sag ((node*2)*1)
#define orta (bas+son)/2

typedef long long ll;
typedef long long int lli;
typedef long long unsigned llu;
typedef pair < int,int > pii;
typedef pair < ll,lli > plli;

const int MAX = 1e2+7;

int n,m,k,i,j,d,l,r,len,ans;

int main()  {
	char p='a',ys='a';
	cin>>n;
	string ns;
	cin>>ns;
	for(int a=0;a<n;a++) {
		if(ns[a]=='D'||ns[a]=='U'){
			if(p=='a'){
				p=ns[a];
			}
			if(p=='D'&&ns[a]=='U'){
				len++;
				p=ns[a];
				ys='a';
			}
			if(p=='U'&&ns[a]=='D'){
				len++;
				p=ns[a];
				ys='a';
				}
		}
		if(ns[a]=='R'||ns[a]=='L') {
			if(ys=='a') {
				ys=ns[a];
				}
			if(ys=='L'&&ns[a]=='R') {
				len++;
				ys=ns[a];
				p='a';
				}
			if(ys=='R'&&ns[a]=='L') {
				len++;
				ys=ns[a];
				p='a';
				}
			}
		}
			cout<<++len;
			return 0;
	}


#include <iostream>
#include <cmath>

using namespace std;

int main(){
	int n, h = 0, v = 0;
	char c;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> c;
		if (c == 'R'){
			h++;
		}
		if (c == 'L'){
			h--;
		}
		if (c == 'U'){
			v++;
		}
		if (c == 'D'){
			v--;
		}
	}
	cout << abs(v) + abs(h);
	return 0;
}


#include <iostream>
#include <cmath>

using namespace std;

int main(){
	int n, count = 0;
	char c;
	bool r = false, l = false, u = false, d = false;
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> c;
		if (c == 'R'){
			r = true;
			if (l == true){
				count++;
				l = false;
				u = false;
				d = false;
			}
		}
		if (c == 'L'){
			l = true;
			if (r == true){
				count++;
				r = false;
				u = false;
				d = false;
			}
		}
		if (c == 'U'){
			u = true;
			if (d == true){
				count++;
				d = false;
				r = false;
				l = false;
			}
		}
		if (c == 'D'){
			d = true;
			if (u == true){
				count++;
				u = false;
				r = false;
				l = false;
			}
		}
	}
	cout << count + 1;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int a[4];
char shit[200005];
char fuck[]={'U','R','L','D'};
int get(char c)
{
    for(int i=0;i<4;i++)
        if(fuck[i]==c) return i;
}
int main() {
    int n;
    scanf("%d",&n);
    scanf("%s",shit);
    int cnt=1;
    for(int i=0;i<n;i++)
    {
        int now=get(shit[i]);
        if(a[3-now]){
            cnt++;
            for(int j=0;j<4;j++)
                a[j]=0;
            a[now]=1;
        }
        else{
            a[now]=1;
        }
    }
    printf("%d\n",cnt);
    return 0;
}


#include <bits/stdc++.h>

#define FOR(i,n) for(int i=0;i<n;i++)
#define ll long long int

using namespace std;

int main(){

	string s1;
	bool l,r,u,d;
	l=u=r=d=false;
	int n;
cin>>n;
	cin >> s1;

	int ctr=1;
	FOR(i,n){
		char c=s1[i];
		switch(c){
			case 'R':
				if(l){
					ctr++	;
					l=false;
					u=false;

					d=false;
				}
					r=true;

				break;

			case 'L':

				if(r){
					ctr++;
					r=false;
					u=false;

					d=false;
				}
				l=true;

			break;
			case 'U':
				if(d){
					ctr++;
					l=false;
					r=false;

					d=false;
				}
				u=true;

			break;

			case 'D':
				if(u){
					ctr++;
					l=false;
					u=false;

					r=false;
				}
					d=true;
		}
	}
	cout<<ctr<<endl;

	return 0;
}


/*
*  Author : Pritish Thakkar
*/

#include<bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <ctime>
#define SET(a) memset(a,-1,sizeof(a))
#define all(a) a.begin(),a.end()
#define clr(a) memset(a,0,sizeof(a))
#define FILL(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define mkp make_pair
#define pi acos(-1.0)
#define inf 1000000009
#define ninf -1000000007
#define FOR(i,a,n) for(long long i=a;i<=n;i++)
#define fre \
	freopen("drstrange.txt","r",stdin);\
	freopen("batman.txt","w",stdout);
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n-1)
#define dead(i,s,n) for(long long i=s;i>=n;i--)
#define dec(i,s) dead(i,s,0LL)
#define TEST int t;cin>>t;while(t--)
using namespace std;
//.............................................

//....@typedef....................
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
//...............................

//.............Translator.................................................
bool isUpperCase(char c){return c>='A' && c<='Z';}//NOTES:isUpperCase
bool isLowerCase(char c){return c>='a' && c<='z';}//NOTES:isLowerCase
bool isLetter(char c){return c>='A' && c<='Z' || c>='a' && c<='z';}//NOTES:isLetter
bool isDigit(char c){return c>='0' && c<='9';}//NOTES:isDigit
char toLowerCase(char c){return (isUpperCase(c))?(c+32):c;}//NOTES:toLowerCase
char toUpperCase(char c){return (isLowerCase(c))?(c-32):c;}//NOTES:toUpperCase
bool isAlpha(char c){return isUpperCase(c)||isLowerCase(c);}//NOTES:isaplhabet or not
//NOTE : long long to string
string toString(ll n){
	vector<ll>  v;
	while(n){
		v.pb(n%10);
		n/=10;
	}
	reverse(v.begin(),v.end());
	string s="";
	ll i;rep(i,v.size()){s.pb(v[i]+'0');}
	return s;
}
//..........................................................................

//.................................GPFNS......................................
template <typename T>T modpow(T base,T exp, T modulus){
	base %= modulus;
	T result = 1;
	while (exp > 0) {
		if (exp & 1) result = (result * base) % modulus;
		base = (base * base) % modulus;exp >>= 1;
	}
	return result;
}
ll gcd(ll a,ll b) {return b==0?a:gcd(b,a%b);}
ll sod(ll n){ll sum = 0;while(n){sum+=n%10;n/=10;}return sum;} // NOTE: sum of digits !!
ll binary_search(ll *a,ll start,ll end,ll toFind){
	ll mid = (start+end)/2;
	if(start < end){
		if(a[mid] == toFind)
			return mid;
		else if(a[mid] < toFind)
			return binary_search(a,mid+1,end,toFind);
		else if(a[mid] > toFind)return binary_search(a,start,mid,toFind);
	}
	return -1;
}
//..................Eratosthenes Sieve........................................

 ll sieve_size;
 bitset <1000010> bs;
 vector<ll> primes;
 void sieve(ll upperbound){
 sieve_size=upperbound+1;
 bs.reset(),bs.flip();//set all nos. to 1
 bs.set(0,false);bs.set(1,false);//except 0 ans 1
 for(ll i=2;i<=sieve_size;i++){
     if(bs.test((size_t)i)){
         for(ll j=i*i;j<=sieve_size;j+=i){
             bs.set((size_t)j,false);
         }
         primes.push_back((ll)i);
         }
     }
 }
//-----------------------Data Type for defining a point---------------------
struct point{
	ll x,y;
};
//-------------------------AREA FOR SOLVEING PROBLEM------------------------------

void solve (){
	ll n;
	cin>>n;
	string s;
	cin>>s;
	ll l,u;
	l=u=0;
	int j,i;
	vector<ll> v;
	v.pb(n-1);
	dec(i,n-1){
		if(s[i] == 'U'){
			u=1;
			break;
		}
		if(s[i] == 'D'){
			break;
		}
	}
	dec(i,n-1){
		if(s[i] == 'L'){
			l=1;
			break;
		}if(s[i] == 'R'){
			break;
		}
	}
	dec(i,n-1){
		switch(s[i]){
			case 'U':{
				if(!u){
					u=1;
					v.pb(i);
					u = l = 0;
					dec(j,i){
						if(s[j] == 'U'){
							u=1;
							break;
						}
						if(s[j] == 'D'){
							break;
						}
					}
					dec(j,i){
						if(s[j] == 'L'){
							l=1;
							break;
						}if(s[j] == 'R'){
							break;
						}
					}
				}
				break;
			}
			case 'D':{
				if(u){
					u=0;
					v.pb(i);
					u = l = 0;
					dec(j,i){
						if(s[j] == 'U'){
							u=1;
							break;
						}
						if(s[j] == 'D'){
							break;
						}
					}
					dec(j,i){
						if(s[j] == 'L'){
							l=1;
							break;
						}if(s[j] == 'R'){
							break;
						}
					}
				}
				break;
			}
			case 'L':{
				if(!l){
					l=1;
					v.pb(i);
					u = l = 0;
					dec(j,i){
						if(s[j] == 'U'){
							u=1;
							break;
						}
						if(s[j] == 'D'){
							break;
						}
					}
					dec(j,i){
						if(s[j] == 'L'){
							l=1;
							break;
						}if(s[j] == 'R'){
							break;
						}
					}
				}
				break;
			}
			case 'R':{
				if(l){
					l=0;
					v.pb(i);
					u = l = 0;
					dec(j,i){
						if(s[j] == 'U'){
							u=1;
							break;
						}
						if(s[j] == 'D'){
							break;
						}
					}
					dec(j,i){
						if(s[j] == 'L'){
							l=1;
							break;
						}if(s[j] == 'R'){
							break;
						}
					}
				}
				break;
			}
		}
	}
	cout<<(v.size())<<endl;
}
//-----------Stay Away from main()----------------------------

int main(){
	std::ios::sync_with_stdio(false);
//	cin.tie(0);
//	cout.tie(0);
	solve();
	return 0;
}

/*
bool ok=1;
	ll sum=0;
	ll start;
	ll index=0;
	if(div[0] == 1){
		ll rat=0;
		start = 1900;
	}else {
		ll rat=0;
		index=0;
		while(div[index] == 2){
			rat += rate[index];
			index++;
		}
		start = 1899-rat+1;
		if(start > 1899){
			ok=0;
		}
	}
	if(!ok){
		cout<<"Impossible\n";
		return;
	}
	ll high = 1e9;
	ll III=0;
	cout<<start<<endl;
	for(int i=0;i<n;i++){
		if(start > 1899 && div[i] == 2){
			ok = 0;
			break;
		}
		if(start < 1900 && div[i] == 1){
			ok=0;
			break;
		}
		start += rate[i];
		cout<<start<<endl;
		if(start > high){
			III = 1;
		}
	}
	if(ok){
		if(III==1){
			cout<<"Infinity\n";
		}else {
			cout<<start<<endl;
		}
	}else {
		cout<<"Impossible\n";
	}
	*/


/*
*  Author : Pritish Thakkar
*/

#include<bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <ctime>
#define SET(a) memset(a,-1,sizeof(a))
#define all(a) a.begin(),a.end()
#define clr(a) memset(a,0,sizeof(a))
#define FILL(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define mkp make_pair
#define pi acos(-1.0)
#define inf 1000000009
#define ninf -1000000007
#define FOR(i,a,n) for(long long i=a;i<=n;i++)
#define fre \
	freopen("drstrange.txt","r",stdin);\
	freopen("batman.txt","w",stdout);
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n-1)
#define dead(i,s,n) for(long long i=s;i>=n;i--)
#define dec(i,s) dead(i,s,0LL)
#define TEST int t;cin>>t;while(t--)
using namespace std;
//.............................................

//....@typedef....................
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
//...............................

//.............Translator.................................................
bool isUpperCase(char c){return c>='A' && c<='Z';}//NOTES:isUpperCase
bool isLowerCase(char c){return c>='a' && c<='z';}//NOTES:isLowerCase
bool isLetter(char c){return c>='A' && c<='Z' || c>='a' && c<='z';}//NOTES:isLetter
bool isDigit(char c){return c>='0' && c<='9';}//NOTES:isDigit
char toLowerCase(char c){return (isUpperCase(c))?(c+32):c;}//NOTES:toLowerCase
char toUpperCase(char c){return (isLowerCase(c))?(c-32):c;}//NOTES:toUpperCase
bool isAlpha(char c){return isUpperCase(c)||isLowerCase(c);}//NOTES:isaplhabet or not
//NOTE : long long to string
string toString(ll n){
	vector<ll>  v;
	while(n){
		v.pb(n%10);
		n/=10;
	}
	reverse(v.begin(),v.end());
	string s="";
	ll i;rep(i,v.size()){s.pb(v[i]+'0');}
	return s;
}
//..........................................................................

//.................................GPFNS......................................
template <typename T>T modpow(T base,T exp, T modulus){
	base %= modulus;
	T result = 1;
	while (exp > 0) {
		if (exp & 1) result = (result * base) % modulus;
		base = (base * base) % modulus;exp >>= 1;
	}
	return result;
}
ll gcd(ll a,ll b) {return b==0?a:gcd(b,a%b);}
ll sod(ll n){ll sum = 0;while(n){sum+=n%10;n/=10;}return sum;} // NOTE: sum of digits !!
ll binary_search(ll *a,ll start,ll end,ll toFind){
	ll mid = (start+end)/2;
	if(start < end){
		if(a[mid] == toFind)
			return mid;
		else if(a[mid] < toFind)
			return binary_search(a,mid+1,end,toFind);
		else if(a[mid] > toFind)return binary_search(a,start,mid,toFind);
	}
	return -1;
}
//..................Eratosthenes Sieve........................................

 ll sieve_size;
 bitset <1000010> bs;
 vector<ll> primes;
 void sieve(ll upperbound){
 sieve_size=upperbound+1;
 bs.reset(),bs.flip();//set all nos. to 1
 bs.set(0,false);bs.set(1,false);//except 0 ans 1
 for(ll i=2;i<=sieve_size;i++){
     if(bs.test((size_t)i)){
         for(ll j=i*i;j<=sieve_size;j+=i){
             bs.set((size_t)j,false);
         }
         primes.push_back((ll)i);
         }
     }
 }
//-----------------------Data Type for defining a point---------------------
struct point{
	ll x,y;
};
//-------------------------AREA FOR SOLVEING PROBLEM------------------------------

void solve (){
	ll n;
	cin>>n;
	string s;
	cin>>s;
	ll l,u;
	l=u=0;
	int j,i;
	vector<ll> v;
	v.pb(n-1);
	ll x,y,z,w;
	x = y = z = w = 0;
	for(int i=0;i<n;i++){
		switch(s[i]){
			case 'U':{
				x++;
				break;
			}
			case 'L':{
				y++;
				break;
			}
			case 'R':{
				z++;
				break;
			}
			case 'D':{
				w++;
				break;
			}
		}
	}
	dec(i,n-1){
		if(s[i] == 'U'){
			u=1;
			break;
		}
		if(s[i] == 'D'){
			break;
		}
	}
	dec(i,n-1){
		if(s[i] == 'L'){
			l=1;
			break;
		}if(s[i] == 'R'){
			break;
		}
	}
	dec(i,n-1){
		switch(s[i]){
			case 'U':{
				x--;
				if(!u){
					u=1;
					v.pb(i);
					u = l = 0;
					u = 1;
					if(y || z){

						dec(j,i){
							if(s[j] == 'L'){
								l=1;
								break;
							}if(s[j] == 'R'){
								break;
							}
						}

					}
				}
				break;
			}
			case 'D':{
				w--;
				if(u){
					u=0;
					v.pb(i);
					u = l = 0;
					if(y || z){

						dec(j,i){
							if(s[j] == 'L'){
								l=1;
								break;
							}if(s[j] == 'R'){
								break;
							}
						}

					}
				}
				break;
			}
			case 'L':{
				y--;
				if(!l){
					l=1;
					v.pb(i);
					u = l = 0;
					l=1;
					if(x || w){

						dec(j,i){
							if(s[j] == 'U'){
								u=1;
								break;
							}if(s[j] == 'D'){
								break;
							}
						}

					}

				}
				break;
			}
			case 'R':{
				z--;
				if(l){
					l=0;
					v.pb(i);
					u = l = 0;
					if(x || w){

						dec(j,i){
							if(s[j] == 'U'){
								u=1;
								break;
							}if(s[j] == 'D'){
								break;
							}
						}

					}
				}
				break;
			}
		}
	}
	cout<<(v.size())<<endl;
}
//-----------Stay Away from main()----------------------------

int main(){
	std::ios::sync_with_stdio(false);
//	cin.tie(0);
//	cout.tie(0);
	solve();
	return 0;
}


/*
*  Author : Pritish Thakkar
*/

#include<bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <ctime>
#define SET(a) memset(a,-1,sizeof(a))
#define all(a) a.begin(),a.end()
#define clr(a) memset(a,0,sizeof(a))
#define FILL(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define mkp make_pair
#define pi acos(-1.0)
#define inf 1000000009
#define ninf -1000000007
#define FOR(i,a,n) for(long long i=a;i<=n;i++)
#define fre \
	freopen("drstrange.txt","r",stdin);\
	freopen("batman.txt","w",stdout);
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n-1)
#define dead(i,s,n) for(long long i=s;i>=n;i--)
#define dec(i,s) dead(i,s,0LL)
#define TEST int t;cin>>t;while(t--)
using namespace std;
//.............................................

//....@typedef....................
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
//...............................

//.............Translator.................................................
bool isUpperCase(char c){return c>='A' && c<='Z';}//NOTES:isUpperCase
bool isLowerCase(char c){return c>='a' && c<='z';}//NOTES:isLowerCase
bool isLetter(char c){return c>='A' && c<='Z' || c>='a' && c<='z';}//NOTES:isLetter
bool isDigit(char c){return c>='0' && c<='9';}//NOTES:isDigit
char toLowerCase(char c){return (isUpperCase(c))?(c+32):c;}//NOTES:toLowerCase
char toUpperCase(char c){return (isLowerCase(c))?(c-32):c;}//NOTES:toUpperCase
bool isAlpha(char c){return isUpperCase(c)||isLowerCase(c);}//NOTES:isaplhabet or not
//NOTE : long long to string
string toString(ll n){
	vector<ll>  v;
	while(n){
		v.pb(n%10);
		n/=10;
	}
	reverse(v.begin(),v.end());
	string s="";
	ll i;rep(i,v.size()){s.pb(v[i]+'0');}
	return s;
}
//..........................................................................

//.................................GPFNS......................................
template <typename T>T modpow(T base,T exp, T modulus){
	base %= modulus;
	T result = 1;
	while (exp > 0) {
		if (exp & 1) result = (result * base) % modulus;
		base = (base * base) % modulus;exp >>= 1;
	}
	return result;
}
ll gcd(ll a,ll b) {return b==0?a:gcd(b,a%b);}
ll sod(ll n){ll sum = 0;while(n){sum+=n%10;n/=10;}return sum;} // NOTE: sum of digits !!
ll binary_search(ll *a,ll start,ll end,ll toFind){
	ll mid = (start+end)/2;
	if(start < end){
		if(a[mid] == toFind)
			return mid;
		else if(a[mid] < toFind)
			return binary_search(a,mid+1,end,toFind);
		else if(a[mid] > toFind)return binary_search(a,start,mid,toFind);
	}
	return -1;
}
//..................Eratosthenes Sieve........................................

 ll sieve_size;
 bitset <1000010> bs;
 vector<ll> primes;
 void sieve(ll upperbound){
 sieve_size=upperbound+1;
 bs.reset(),bs.flip();//set all nos. to 1
 bs.set(0,false);bs.set(1,false);//except 0 ans 1
 for(ll i=2;i<=sieve_size;i++){
     if(bs.test((size_t)i)){
         for(ll j=i*i;j<=sieve_size;j+=i){
             bs.set((size_t)j,false);
         }
         primes.push_back((ll)i);
         }
     }
 }
//-----------------------Data Type for defining a point---------------------
struct point{
	ll x,y;
};
//-------------------------AREA FOR SOLVEING PROBLEM------------------------------

void solve (){
	ll n;
	cin>>n;
	string s;
	cin>>s;
	ll l,u;
	l=u=0;
	int j,i;
	ll left[n],right[n],up[n],down[n];
	rep(i,n){
		left[i] = right[i] = up[i] = down[i] = -1;
	}
	vector<ll> v;
	v.pb(n-1);
	ll x,y,z,w;
	x = y = z = w = 0;
	rep(i,n){
		if(s[i] == 'U'){
			up[i] = i;
		}else if(i){
			up[i] = up[i-1];
		}

		if(s[i] == 'L'){
			left[i] = i;
		}else if(i){
			left[i] = left[i-1];
		}

		if(s[i] == 'R'){
			right[i] = i;
		}else if(i){
			right[i] = right[i-1];
		}

		if(s[i] == 'D'){
			down[i] = i;
		}else if(i){
			down[i] = down[i-1];
		}

	}

	dec(i,n-1){
		if(s[i] == 'U'){
			u=1;
			break;
		}
		if(s[i] == 'D'){
			break;
		}
	}
	dec(i,n-1){
		if(s[i] == 'L'){
			l=1;
			break;
		}if(s[i] == 'R'){
			break;
		}
	}
	dec(i,n-1){
		switch(s[i]){
			case 'U':{
				x--;
				if(!u){
					u=1;
					v.pb(i);
					u = l = 0;
					u = 1;
					if(left[i] > right[i]){
						l=1;
					}
				}
				break;
			}
			case 'L':{
				y--;
				if(!l){
					l=1;
					v.pb(i);
					u = l = 0;
					l=1;
					if(up[i] > down[i]){
						u=1;
					}
				}
				break;
			}
			case 'R':{
				z--;
				if(l){
					l=0;
					v.pb(i);
					u = l = 0;
					if(up[i] > down[i]){
						u=1;
					}
				}
				break;
			}
			case 'D':{
				w--;
				if(u){
					u=0;
					v.pb(i);
					u = l = 0;
					if(left[i] > right[i]){
						l=1;
					}
				}
				break;
			}
		}
	}
	cout<<(v.size())<<endl;
}
//-----------Stay Away from main()----------------------------

int main(){
	std::ios::sync_with_stdio(false);
//	cin.tie(0);
//	cout.tie(0);
	solve();
	return 0;
}


#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair
#define sz(x) (int)(x).size()
#define li long long
#define ld long double
#define x first
#define y second
#define pt pair<int, int>
#define pll pair<ll, ll>
#define forn(i, t) for(int i = 0; i < (t); i++)
#define fore(i, f, t) for(int i = (f); i < (t); i++)
#define forr(i, f, t) for(int i = (f) - 1; i >= (t); i--)
#define all(x) (x).begin(), (x).end()
#define ins insert

using namespace std;

const int INF = 2147483647;
const int MOD = 1000000007;
const li INF64 = 9223372036854775807;
const ld EPS = 1e-7;

mt19937 myrand(time(NULL));

multiset<pt> pnt;

const int N = 200 * 1000 + 13;

int n;
string s;

bool read(){
	char buf[N];
	if(scanf("%d\n", &n) != 1)
		return 0;
	scanf("%s\n", buf);
	s = buf;
	return 1;
}

void solve(){
	int x = 0, y = 0;
	int used[4];
	memset(used, 0, sizeof(used));
	pnt = multiset<pt>();
	int cur;
	forn(i, n){
		if (s[i] == 'U')
			cur = 0;
		else if (s[i] == 'R')
			cur = 1;
		else if (s[i] == 'D')
			cur = 2;
		else
			cur = 3;

		if (used[(cur + 2) % 4]){
			pnt.insert(mp(x, y));
			memset(used, 0, sizeof(used));
		}

		if (cur == 0)
			y--;
		else if (cur == 1)
			x++;
		else if (cur == 2)
			y++;
		else
			x--;

		used[cur] = 1;
	}
	pnt.insert(mp(x, y));
	printf("%d\n", sz(pnt));
}

int main(){
	#ifdef _DEBUG
		freopen("input.txt", "r", stdin);
	#endif
	while(read())
		solve();
	return 0;
}


#include <iostream>
using namespace std;
int main() {
	long long int n,k=1;
	cin>>n;
	char c;
	char up=' ';
	char left=' ';
	for(int i=0;i<n;i++){
	    cin>>c;
	    if(c==left){
	       k++;
	       up=' ';
	    }else
	    if(c==up){
	       k++;
	       left=' ';
	       }
	    if(c=='U'){
	        up='D';
	    } else
	    if(c=='L'){
	        left='R';
	    }else
	    if(c=='D'){
	        up='U';
	    }else
	    if(c=='R'){
	        left='L';
	    }
	}
	cout<<k;
	return 0;
}


#include <iostream>
using namespace std;
int main() {
	long long int n,k=1;
	cin>>n;
	char c;
	char up='N';
	char left='N';
	for(int i=0;i<n;i++){
	    cin>>c;
	    if(c==left){
	       k++;
	       char up='N';
	    }else
	    if(c==up){
	       k++;
	       char left='N';
	       }
	    if(c=='U'){
	        up='D';
	    } else
	    if(c=='L'){
	        left='R';
	    }else
	    if(c=='D'){
	        up='U';
	    }else
	    if(c=='R'){
	        left='L';
	    }
	}
	cout<<k;
	return 0;
}


/*	        Made by
	      Tashibana Kanade       */
/*  ---> IOI2018(JAPAN) <---   */

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define bp pop_back
#define mp make_pair
#define sz(x) ((int)(x.size()))
#define all(x) x.begin(), x.end()

typedef long double ld;
typedef vector < int > vi;
typedef pair < int , int > pii;
typedef long long ll;
typedef unsigned long long ull;

const char nxtl = (char) '\n';
const int maxn =  (int) 2e5 + 5;
const int INF_INT = (int) 1e9 + 99;
const ll INF_BIG = (ll) 1e18 + 99;
const int MOD = (int) 1e9 + 7;

map < char , bool > used;
int ans = 0;

int main () {
	ios_base :: sync_with_stdio(false); cin.tie(NULL);
	#ifdef asdfqwer
	freopen(".in", "r", stdin);
	#endif
	/* C */
	int n;
	string s;
	cin >> n >> s;
	for (int i = 0; i < n; ++ i) {
		if (s[i] == 'L') {
			if (used['R']) {
				used['R'] = used['U'] = used['L'] = used['D'] = false;
				ans ++;
			}
			used['L'] = true;
		}
		else if (s[i] == 'R') {
			if (used['L']) {
				used['R'] = used['U'] = used['L'] = used['D'] = false;
				ans ++;
			}
			used['R'] = true;
		}
		else if (s[i] == 'U') {
			if (used['D']) {
				used['R'] = used['U'] = used['L'] = used['D'] = false;
				ans ++;
			}
			used['U'] = true;
		}
		else if (s[i] == 'D') {
			if (used['U']) {
				used['R'] = used['U'] = used['L'] = used['D'] = false;
				ans ++;
			}
			used['D'] = true;
		}
	}
	cout << ans + 1;
	return 0;
}


/*	        Made by
	      Tashibana Kanade       */
/*  ---> IOI2018(JAPAN) <---   */

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define bp pop_back
#define mp make_pair
#define sz(x) ((int)(x.size()))
#define all(x) x.begin(), x.end()

typedef long double ld;
typedef vector < int > vi;
typedef pair < int , int > pii;
typedef long long ll;
typedef unsigned long long ull;

const char nxtl = (char) '\n';
const int maxn =  (int) 2e5 + 5;
const int INF_INT = (int) 1e9 + 99;
const ll INF_BIG = (ll) 1e18 + 99;
const int MOD = (int) 1e9 + 7;

map < char , bool > used;
int ans = 0;

int main () {
	ios_base :: sync_with_stdio(false); cin.tie(NULL);
	#ifdef asdfqwer
	freopen(".in", "r", stdin);
	#endif
	/* C */
	int n;
	string s;
	cin >> n >> s;
	for (int i = 0; i < n; ++ i) {
		if (s[i] == 'L') {
			if (used['R']) {
				used['R'] = used['U'] = used['L'] = used['U'] = false;
				ans ++;
			}
			used['L'] = true;
		}
		if (s[i] == 'R') {
			if (used['L']) {
				used['R'] = used['U'] = used['L'] = used['U'] = false;
				ans ++;
			}
			used['R'] = true;
		}
		if (s[i] == 'U') {
			if (used['D']) {
				used['R'] = used['U'] = used['L'] = used['U'] = false;
				ans ++;
			}
			used['U'] = true;
		}

		if (s[i] == 'D') {
			if (used['U']) {
				used['R'] = used['U'] = used['L'] = used['U'] = false;
				ans ++;
			}
			used['D'] = true;
		}
	}
	cout << ans + 1;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

char d = 'A', d2 = 'A', s;
int n, res = 1;

int main()
{
//    freopen("test.txt","r",stdin);
    cin >> n;
    for (int i = 1; i <= n; ++i)
    {
        cin >> s;
        bool kt = 0;
        if ((s == 'L' || s == 'R') && s != d)
        {
            if (d == 'A') d = s; else ++res, d = s, kt = 1, d2 = 'A';
        }
        if ((s == 'U' || s == 'D') && s != d2)
        {
            if (d2 == 'A') d2 = s; else ++res, d2 = s, kt = 1, d = 'A';
        }
    }
    cout << res;
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
// Policy based data structure
typedef tree<int, null_type,
			less_equal<int>, rb_tree_tag,
			tree_order_statistics_node_update>
	indexed_set;
#define ll long long int
#define pii pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define vi vector<ll>
#define vii vector<pii>
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define yes cout<<"YES"<<endl; return;
#define no cout<<"NO"<<endl; return;
#define flus fflush(stdin); fflush(stdout);
#define F first
#define S second
#define np next_permutation
#define inf 1e18
#define mod 1000000007
#define N 200009
#define pi (double)2*acos(0.0)
#define minpq priority_queue <ll, vector<ll>, greater<ll>>
#define maxpq priority_queue<ll>
void sout(){
	cout<<endl;
}
template <typename T,typename... Types>
void sout(T var1,Types... var2){
	cout<<var1<<" ";
	sout(var2...);
}
/*******************************************************************/

void solve(){
	ll n;
	cin>>n;
	string s;
	cin>>s;
	pii st={0,0};
	ll ans=1;
	ll len=0;
	pii prev={0,0};
	rep(i,0,n){
		pii curr=prev;
		if(s[i]=='D')
			curr.F++;
		else if(s[i]=='U')
			curr.F--;
		else if(s[i]=='R')
			curr.S++;
		else
			curr.S--;
		len++;
		if(len==abs(st.F-curr.F)+abs(st.S-curr.S)){
			prev=curr;
			continue;
		} else{
			ans++;
			st=prev;
			prev=curr;
			len=1;
		}
	}
	cout<<ans<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	// cin>>t;
	t=1;
	while(t--){
		solve();
	}
}


#include <bits/stdc++.h>

using namespace std;

#define fo(i,n)   for(i=0;i<(n);++i)
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define endl '\n'
#define PI 3.1415926535897932384626433832795
#define all(x) x.begin(), x.end()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

const ll inf = LONG_MAX;
const ll arr = 1000000; /// 10^6

bool comp(pll a, pll b)
{
    if(a.first==b.first) return a.second<b.second; else return a.first<b.first;
}

bool check(set<char> st)
{
    if(st.size()>2||st.size()<=1) return true;
    vector<char> v;
    for(auto f:st)
        v.pb(f);
    if(v[0]=='L'&&v[1]=='R') return false;
    if(v[0]=='R'&&v[1]=='L') return false;
    if(v[0]=='U'&&v[1]=='D') return false;
    if(v[0]=='U'&&v[1]=='D') return false;
    return true;
}

int main(void)
{
    ll n;
    cin >> n;
    string s;
    cin >> s;
    set<char> st;
    ll ans = 0;
    for(int i=0; i<n; i++)
    {
        st.insert(s[i]);
        if(st.size()<=2&&check(st)==true) continue; else
        {
            st.clear();
            ans++;
            st.insert(s[i]);
        }
    }

    cout << ans+1 << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define fo(i,n)   for(i=0;i<(n);++i)
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define endl '\n'
#define PI 3.1415926535897932384626433832795
#define all(x) x.begin(), x.end()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

const ll inf = LONG_MAX;
const ll arr = 1000000; /// 10^6

bool comp(pll a, pll b)
{
    if(a.first==b.first) return a.second<b.second; else return a.first<b.first;
}

bool check(set<char> st)
{
    if(st.size()>2||st.size()<=1) return true;
    vector<char> v;
    for(auto f:st)
        v.pb(f);
    if(v[0]=='L'&&v[1]=='R') return false;
    if(v[0]=='R'&&v[1]=='L') return false;
    if(v[0]=='U'&&v[1]=='D') return false;
    if(v[0]=='D'&&v[1]=='U') return false;
    return true;
}

int main(void)
{
    ll n;
    cin >> n;
    string s;
    cin >> s;
    set<char> st;
    ll ans = 0;
    for(int i=0; i<n; i++)
    {
        st.insert(s[i]);
        if(st.size()<=2&&check(st)==true) continue; else
        {
            st.clear();
            ans++;
            st.insert(s[i]);
        }
    }

    cout << ans+1 << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define dump(x) cerr << #x " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define endl '\n'

#ifdef _DEBUG27_
    //#define STRESS 1
#endif

const int INF = 2e9;
const long long LINF = 2e18;

typedef long long llong;

void inv(bool e);
template<typename T> void die(T& a);

bool brute, alter;
int cnt_tests = 1;

// Div1 ?

// Code below

string s;
void inp() {
    cin >> s >> s;
}

bool neg(char a, char b) {
    if (a == 'L' && b == 'R')
        return true;
    if (a == 'R' && b == 'L')
        return true;
    if (a == 'U' && b == 'D')
        return true;
    if (a == 'D' && b == 'U')
        return true;
    return false;
}

void solve() {
    int p = 0, l;
    set<char> un;
    vector<int> point(sz(s));
    for (l = 0; l < sz(s); l++) {
        for (; p < sz(s); p++) {
            if (!un.empty() && neg(*un.begin(), s[p])) {
                break;
            }
            un.insert(s[p]);
            if (sz(un) > 2) {
                break;
            }
        }
        if (p == sz(s))
            break;
        point[p - 1] = 1;
        un.clear();
    }
    point[sz(s) - 1] = 1;
    int ans = 0;
    for (auto x: point) {
        ans += x;
    }
    cout << ans;
}

void stress() {

}

void naive() {

}

void run();
int main() {
    #ifdef _DEBUG27_
        if (1)
            freopen("input.txt", "r", stdin);
    #else
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        if (0) {
            freopen("stack.in", "r", stdin);
            freopen("stack.out", "w", stdout);
        }
    #endif
    #ifdef STRESS
        srand(time(0));
        brute = true;
    #else
        brute = false;
    #endif

    for (int i = 0; (i < cnt_tests); i++) {
        run();
    }
    cerr << endl << "Time: " << clock() / 1000.0 << " ms";
    return 0;
}

void run() {
    if (!brute) {
        inp();
    }
    else {
        stress();
    }
    solve();
}

template<typename T>
void die(T& a) {
    cout << a;
    exit(0);
}

void inv(bool e) {
    if (!e) {
        vector<int> a;
        a[-1] += 1;
    }
}

/** CLEARING BUFFER

    cout << VAL << flush;

    OR

    printf(VAL);
    fflush(stdout);
*/


#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
#define ll long long int
int main(){
	ios_base::sync_with_stdio(false);
	string  str1,str2;
	//cout<<"lol\n";
	cin>>str1;
	cin>>str2;
	//cout<<"lnm\n";
	int n=str1.size();
	vector<char>v1,v2;
    for(int i=0;i<n;i++){
    	v1.push_back(str1[i]);
    	v2.push_back(str2[i]);
    }
    string ans="";
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    // for(int i=0;i<n;i++) cout<<v1[i]<<" ";
    // 	cout<<endl;
    // for(int i=0;i<n;i++) cout<<v2[i]<<" ";
    // 	cout<<endl;
    //cout<<"hi\n";
    int cnt=0;
    int i=0,j=n-1;
    bool flg=false;
    while(i<n && j>=0){
    	//cout<<"hi\n";
    	if(cnt&1){
            if(v2[j] >= v1[i] ){
            	ans+=v2[j];
    			//j--;
            }
    		j--;
    	}
    	else{
    	  if(v2[j] >= v1[i]){
    	  	 ans+=v1[i];
           	//i++;
    	  }
    	  i++;

    	}
    	cnt++;
    }
    while(i<n){
    	ans+=v1[i];
    	i++;
    }
    while(j>=0)
    {
    	ans+=v2[j];
    	j--;
    }
    for(int i=0;i<n;i++)
    	cout<<ans[i];
   cout<<endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
#define ll long long int
int main(){
	ios_base::sync_with_stdio(false);
	string  str1,str2;
	//cout<<"lol\n";
	cin>>str1;
	cin>>str2;
	//cout<<"lnm\n";
	int n=str1.size();
	vector<char>v1,v2;
    for(int i=0;i<n;i++){
    	v1.push_back(str1[i]);
    	v2.push_back(str2[i]);
    }
    string ans="";
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    // for(int i=0;i<n;i++) cout<<v1[i]<<" ";
    // 	cout<<endl;
    // for(int i=0;i<n;i++) cout<<v2[i]<<" ";
    // 	cout<<endl;
    //cout<<"hi\n";
    int cnt=0;
    int i=0,j=n-1;
    bool flg=false;
    while(i<n && j>=0){
    	//cout<<"hi\n";
    	if(cnt&1){
            if(v2[j] > v1[i] ){
            	ans+=v2[j];
    			//j--;
            }
    		j--;
    	}
    	else{
    	  if(v2[j] > v1[i]){
    	  	 ans+=v1[i];
           	//i++;
    	  }
    	  i++;

    	}
    	cnt++;
    }
    while(i<n){
    	ans+=v1[i];
    	i++;
    }
    while(j>=0)
    {
    	ans+=v2[j];
    	j--;
    }
    for(int i=0;i<n;i++)
    	cout<<ans[i];
   cout<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
using namespace std;

string a,b,ans="";
multiset<int> st1,st2;

int main(){
    cin>>a>>b;
    ans = a;
    for(int i=0;i<(a.size()+1)/2;i++) st1.insert(a[i]);
    for(int i=0;i<b.size()/2;i++) st2.insert(b[i]);
    int l=0, r=a.size()-1;
    for(int i=0;i<a.size();i++){
        int x,y;
        multiset<int>::iterator it;
        if(i==a.size()-1){
            if(i%2==0) x = *(st1.begin()), ans[l] = x;
            else{
                it = st2.end();
                it--;
                y = *(it);
                ans[l] = y;
            }
            continue;
        }
        x = *(st1.begin());
        it = st2.end();
        it--;
        y = *(it);
        if(i%2==0){
            if(x>=y){
                it = st1.end();
                it--;
                x = (*it);
                ans[r--] = x;
            }
            else ans[l++] = x;
            it = st1.find(x);
            st1.erase(it);
        }
        else{
            if(y<=x){
                y = *(st2.begin());
                ans[r--] = y;
            }
            else ans[l++] = y;
            it = st2.find(y);
            st2.erase(it);
        }
    }
    cout<<ans<<endl;
    return 0;
}


#include <bits/stdc++.h>
#define LL long long
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
using namespace std;

string a,b,ans="";
multiset<int> st1,st2;

int main(){
    cin>>a>>b;
    ans = a;
    for(int i=0;i<(a.size()+1)/2;i++) st1.insert(a[i]);
    for(int i=0;i<b.size()/2;i++) st2.insert(b[i]);
    int l=0, r=a.size()-1;
    for(int i=0;i<a.size();i++){
        int x,y;
        multiset<int>::iterator it;
        if(i==a.size()-1){
            if(i%2==0) x = *(st.begin()), ans[l] = x;
            else{
                it = st2.end();
                it--;
                y = *(it);
                ans[l] = y;
            }
            continue;
        }
        x = *(st.begin());
        it = st2.end();
        it--;
        y = *(it);
        if(i%2==0){
            if(x>=y){
                it = st.end();
                it--;
                x = (*it);
                ans[r--] = x;
            }
            else ans[l++] = x;
            it = st.find(x);
            st.erase(it);
        }
        else{
            if(y<=x){
                y = *(st2.begin());
                ans[r--] = y;
            }
            else ans[l++] = y;
            it = st2.find(y);
            st2.erase(it);
        }
    }
    cout<<ans<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string s, t;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s >> t;
	int n = s.size();
	map<char, int> mp1, mp2;
	FOR(i, n) {
		mp1[s[i]]++;
		mp2[t[i]]++;
	}
	vector<char> res1, res2;
	for (auto itr = mp1.begin(); itr != mp1.end(); ++itr) {
		FOR(i, itr->second) res1.push_back(itr->first);
	}
	for (auto itr = mp2.rbegin(); itr != mp2.rend(); ++itr) {
		FOR(i, itr->second) res2.push_back(itr->first);
	}
	vector<char> ans;
	FOR(i, n) {
		ans.push_back(res1[i]);
		ans.push_back(res2[i]);
	}
	FOR(i, n) cout << ans[i];
	cout << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define FORR(x, arr) for(auto& x:arr)
#define ITR(x, c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
typedef pair<int, int> P;

string s1, s2;
bool used[300005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s1 >> s2;
	int n = s1.size();

	sort(ALL(s1));
	sort(s2.rbegin(), s2.rend());
	s1 = s1.substr(0, (n+1)/2);
	s2 = s2.substr(0, n/2);

	deque<char> d1, d2;
	FORR(s, s1) d1.push_back(s);
	FORR(s, s2) d2.push_back(s);

	vector<char> ans(n);
	int l = 0, r = n-1;
	FOR(i, n) {
		if (i & 1) {
			if (d1.front() > d2.back()) {
				while (r > 0 && used[r]) r--;
				ans[r] = d2.back();
				d2.pop_back();
				used[r] = true;
			}
			else {
				while (l < n-1 && used[l]) l++;
				ans[l] = d2.front();
				d2.pop_front();
				used[l] = true;
			}
		}
		else {
			if (d2.empty()) {
				while (used[l]) l++;
				ans[l] = d1.back();
				d1.pop_back();
				used[l] = true;
			}
			else if (d1.front() > d2.back()) {
				while (r > 0 && used[r]) r--;
				ans[r] = d1.back();
				d1.pop_back();
				used[r] = true;
			}
			else {
				while (l < n-1 && used[l]) l++;
				ans[l] = d1.front();
				d1.pop_front();
				used[l] = true;
			}
		}
	}
	FOR(i, n) cout << ans[i] << (i == n-1 ? "\n" : "");
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string str1, str2;
char s[300005], t[300005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> str1 >> str2;
	int n = str1.size();
	FOR(i, n) {
		s[i] = str1[i];
		t[i] = str2[i];
	}
	sort(s, s+n);
	sort(t, t+n);
	reverse(t, t+n);
	int ss = 0, se = (n+1)/2-1, ts = 0, te = n/2-1;
	string u = s;
	FOR(i, n) {
		if (i & 1) {
			if (s[ss] < t[ts]) u[i] = t[ts++];
			else u[i] = t[te--];
		}
		else {
			if (s[ss] < t[ts]) u[i] = s[ss++];
			else u[i] = s[se--];
		}
	}
	cout << u << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string s, t;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s >> t;
	int n = s.size();
	priority_queue<char, vector<char>, greater<char> > res1;
	priority_queue<char> res2;
	FOR(i, n) {
		res1.push(s[i]);
		res2.push(t[i]);
	}

	vector<char> ans1, ans2;
	FOR(i, n/2) {
		if (res1.top() <= res2.back()) {
			ans1.push_back(res1.top());
			ans1.push_back(res2.top());
		}
		else {
			ans2.push_back(res1.top());
			ans2.push_back(res2.top());
		}
		res1.pop();
		res2.pop();
	}
	if (n & 1) ans1.push_back(res1.top());
	reverse(ans2.begin(), ans2.end());
	FOR(i, ans1.size()) cout << ans1[i];
	FOR(i, ans2.size()) cout << ans2[i];
	cout << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string str1, str2;
char s[300005], t[300005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> str1 >> str2;
	int n = str1.size();
	FOR(i, n) {
		s[i] = str1[i];
		t[i] = str2[i];
	}
	sort(s, s+n);
	sort(t, t+n);
	reverse(t, t+n);
	int ss = 0, se = (n+1)/2-1, ts = 0, te = n/2-1, us = 0, ue = n-1;
	string u = s;
	FOR(i, n) {
		if (i & 1) {
			if (s[ss] <= t[ts]) u[us++] = t[ts++];
			else {
				u[ue--] = t[te--];
				// ue--;
			}
		}
		else {
			if (s[ss] <= t[ts]) u[us++] = s[ss++];
			else {
				u[ue--] = s[se--];
				// ue--;
			}
		}
	}
	cout << u << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define FORR(x, arr) for(auto& x:arr)
#define ITR(x, c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
typedef pair<int, int> P;

string s1, s2;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s1 >> s2;
	int n = s1.size();
	priority_queue<char, vector<char>, greater<char> > q1;
	priority_queue<char> q2;
	FORR(s, s1) q1.push(s);
	FORR(s, s2) q2.push(s);
	string s = "";
	FOR(i, n) {
		if (i & 1) {
			s += string(1, q2.top());
			q2.pop();
		}
		else {
			s += string(1, q1.top());
			q1.pop();
		}
	}
	cout << s << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string str1, str2;
char s[300005], t[300005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> str1 >> str2;
	int n = str1.size();
	FOR(i, n) {
		s[i] = str1[i];
		t[i] = str2[i];
	}
	sort(s, s+n);
	sort(t, t+n);
	reverse(t, t+n);
	int ss = 0, se = (n+1)/2-1, ts = 0, te = n/2-1, ue = n-1;
	string u = s;
	FOR(i, n) {
		if (i & 1) {
			if (s[ss] <= t[ts]) u[i] = t[ts++];
			else u[ue--] = t[te--];
		}
		else {
			if (s[ss] <= t[ts]) u[i] = s[ss++];
			else u[ue--] = s[se--];
		}
	}
	cout << u << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string s, t;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s >> t;
	int n = s.size();
	priority_queue<char, vector<char>, greater<char> > que1;
	priority_queue<char> que2;
	FOR(i, n) {
		que1.push(s[i]);
		que2.push(t[i]);
	}
	queue<char> res1, res2;
	FOR(i, n) {
		res1.push(que1.top());
		res2.push(que2.top());
		que1.pop();
		que2.pop();
	}

	// cout << res1.front() << res2.front() << endl;

	vector<char> ans1, ans2;
	FOR(i, n/2) {
		// if (res1.front() <= res2.front()) {
			ans1.push_back(res1.front());
			ans1.push_back(res2.front());
		// }
		// else {
		// 	ans2.push_back(res1.front());
		// 	ans2.push_back(res2.front());
		// }
		res1.pop();
		res2.pop();
	}
	if (n & 1) ans1.push_back(res1.front());
	reverse(ans2.begin(), ans2.end());
	FOR(i, ans1.size()) cout << ans1[i];
	FOR(i, ans2.size()) cout << ans2[i];
	cout << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string s, t;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s >> t;
	int n = s.size();
	priority_queue<char, vector<char>, greater<char> > res1;
	priority_queue<char> res2;
	FOR(i, n) {
		res1.push(s[i]);
		res2.push(t[i]);
	}

	vector<char> ans1;
	FOR(i, n/2) {
		ans1.push_back(res1.top());
		ans1.push_back(res2.top());
		res1.pop();
		res2.pop();
	}
	if (n & 1) ans1.push_back(res1.top());
	if (res1.top() > res2.top()) reverse(ans1.begin(), ans1.end());
	FOR(i, ans1.size()) cout << ans1[i];
	cout << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string str1, str2;
char s[300005], t[300005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> str1 >> str2;
	int n = str1.size();
	FOR(i, n) {
		s[i] = str1[i];
		t[i] = str2[i];
	}
	sort(s, s+n);
	sort(t, t+n);
	reverse(t, t+n);
	int ss = 0, se = (n+1)/2-1, ts = 0, te = n/2-1, us = 0, ue = n-1;
	vector<char> u1, u2;
	FOR(i, n/2) {
		if (s[ss] <= t[ts]) {
			u1.push_back(s[ss++]);
			u1.push_back(t[ts++]);
		}
		else {
			u2.push_back(s[se--]);
			u2.push_back(t[te--]);
		}
	}
	if (n & 1) u1.push_back(s[ss]);
	reverse(u2.begin(), u2.end());
	FOR(i, u1.size()) cout << u1[i];
	FOR(i, u2.size()) cout << u2[i];
	cout << endl;
	// cout << u << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string str1, str2;
char s[300005], t[300005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> str1 >> str2;
	int n = str1.size();
	FOR(i, n) {
		s[i] = str1[i];
		t[i] = str2[i];
	}
	sort(s, s+n);
	sort(t, t+n);
	reverse(t, t+n);
	int ss = 0, se = (n+1)/2-1, ts = 0, te = n/2-1;
	string u = s;
	FOR(i, n) {
		if (i & 1) {
			if (s[ss] <= t[ts]) u[i] = t[ts++];
			else u[i] = t[te--];
		}
		else {
			if (s[ss] <= t[ts]) u[i] = s[ss++];
			else u[i] = s[se--];
		}
	}
	cout << u << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string s, t;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s >> t;
	int n = s.size();
	priority_queue<char, vector<char>, greater<char> > que1;
	priority_queue<char> que2;
	FOR(i, n) {
		que1.push(s[i]);
		que2.push(t[i]);
	}
	queue<char> res1, res2;
	FOR(i, n) {
		res1.push(que1.top());
		res2.push(que2.top());
		que1.pop();
		que2.pop();
	}

	// cout << res1.front() << res2.front() << endl;

	vector<char> ans1, ans2;
	FOR(i, n/2) {
		if (res1.front() <= res2.front()) {
			ans1.push_back(res1.front());
			ans1.push_back(res2.front());
		}
		else {
			ans2.push_back(res1.front());
			ans2.push_back(res2.front());
		}
		res1.pop();
		res2.pop();
	}
	if (n & 1) ans1.push_back(res1.front());
	reverse(ans2.begin(), ans2.end());
	FOR(i, ans1.size()) cout << ans1[i];
	FOR(i, ans2.size()) cout << ans2[i];
	cout << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define FORR(x, arr) for(auto& x:arr)
#define ITR(x, c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
typedef pair<int, int> P;

string s1, s2;
bool used[300005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s1 >> s2;
	int n = s1.size();

	sort(ALL(s1));
	sort(s2.rbegin(), s2.rend());
	s1 = s1.substr(0, (n+1)/2);
	s2 = s2.substr(0, n/2);

	deque<char> d1, d2;
	FORR(s, s1) d1.push_back(s);
	FORR(s, s2) d2.push_back(s);

	vector<char> ans(n);
	int l = 0, r = n-1;
	FOR(i, n) {
		if (i & 1) {
			if (d1.front() >= d2.front()) {
				while (r > 0 && used[r]) r--;
				ans[r] = d2.back();
				d2.pop_back();
				used[r] = true;
			}
			else {
				while (l < n-1 && used[l]) l++;
				ans[l] = d2.front();
				d2.pop_front();
				used[l] = true;
			}
		}
		else {
			if (d2.empty()) {
				while (used[l]) l++;
				ans[l] = d1.back();
				d1.pop_back();
				used[l] = true;
			}
			else if (d1.front() >= d2.front()) {
				while (r > 0 && used[r]) r--;
				ans[r] = d1.back();
				d1.pop_back();
				used[r] = true;
			}
			else {
				while (l < n-1 && used[l]) l++;
				ans[l] = d1.front();
				d1.pop_front();
				used[l] = true;
			}
		}
	}
	FOR(i, n) cout << ans[i] << (i == n-1 ? "\n" : "");
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string s, t;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s >> t;
	int n = s.size();
	priority_queue<char, vector<char>, greater<char> > res1;
	priority_queue<char> res2;
	FOR(i, n) {
		res1.push(s[i]);
		res2.push(t[i]);
	}

	vector<char> ans1;
	bool flag = false;
	if (res1.top() > res2.top()) flag = true;
	FOR(i, n/2) {
		ans1.push_back(res1.top());
		ans1.push_back(res2.top());
		res1.pop();
		res2.pop();
	}
	if (n & 1) ans1.push_back(res1.top());
	if (flag) reverse(ans1.begin(), ans1.end());
	FOR(i, ans1.size()) cout << ans1[i];
	cout << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define FORR(x, arr) for(auto& x:arr)
#define ITR(x, c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;
typedef pair<int, int> P;

string s1, s2;
bool used[300005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s1 >> s2;
	int n = s1.size();

	sort(ALL(s1));
	sort(s2.rbegin(), s2.rend());
	s1 = s1.substr(0, (n+1)/2);
	s2 = s2.substr(0, n/2);

	deque<char> d1, d2;
	FORR(s, s1) d1.push_back(s);
	FORR(s, s2) d2.push_back(s);

	vector<char> ans(n);
	int l = 0, r = n-1;
	FOR(i, n) {
		if (i & 1) {
			if (d1.front() > d2.back()) {
				while (r > 0 && used[r]) r--;
				ans[r] = d2.back();
				d2.pop_back();
				used[r] = true;
			}
			else {
				while (l < n-1 && used[l]) l++;
				ans[l] = d2.front();
				d2.pop_front();
				used[l] = true;
			}
		}
		else {
			if (d1.front() > d2.back()) {
				while (r > 0 && used[r]) r--;
				ans[r] = d1.back();
				d1.pop_back();
				used[r] = true;
			}
			else {
				while (l < n-1 && used[l]) l++;
				ans[l] = d1.front();
				d1.pop_front();
				used[l] = true;
			}
		}
	}
	FOR(i, n) cout << ans[i] << (i == n-1 ? "\n" : "");
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string s, t;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s >> t;
	int n = s.size();
	priority_queue<char, vector<char>, greater<char> > res1;
	priority_queue<char> res2;
	FOR(i, n) {
		res1.push(s[i]);
		res2.push(t[i]);
	}

	vector<char> ans1, ans2;
	FOR(i, n/2) {
		if (res1.top() <= res2.top()) {
			ans1.push_back(res1.top());
			ans1.push_back(res2.top());
		}
		else {
			ans2.push_back(res1.top());
			ans2.push_back(res2.top());
		}
		res1.pop();
		res2.pop();
	}
	if (n & 1) ans1.push_back(res1.top());
	FOR(i, ans1.size()) cout << ans1[i];
	FOR(i, ans2.size()) cout << ans2[i];
	cout << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string str1, str2;
char s[300005], t[300005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> str1 >> str2;
	int n = str1.size();
	FOR(i, n) {
		s[i] = str1[i];
		t[i] = str2[i];
	}
	sort(s, s+n);
	sort(t, t+n);
	reverse(t, t+n);
	int ss = 0, se = (n+1)/2, ts = 0, te = n/2;
	string u = s;
	FOR(i, n) {
		if (i & 1) {
			if (s[ss] < t[ts]) u[i] = t[ts++];
			else u[i] = t[te--];
		}
		else {
			if (s[ss] < t[ts]) u[i] = s[ss++];
			else u[i] = s[se--];
		}
	}
	cout << u << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string s, t;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> s >> t;
	int n = s.size();
	priority_queue<char, vector<char>, greater<char> > res1;
	priority_queue<char> res2;
	FOR(i, n) {
		res1.push(s[i]);
		res2.push(t[i]);
	}

	vector<char> ans1, ans2;
	FOR(i, n/2) {
		if (res1.top() <= res2.top()) {
			ans1.push_back(res1.top());
			ans1.push_back(res2.top());
		}
		else {
			ans2.push_back(res1.top());
			ans2.push_back(res2.top());
		}
		res1.pop();
		res2.pop();
	}
	if (n & 1) ans1.push_back(res1.top());
	reverse(ans2.begin(), ans2.end());
	FOR(i, ans1.size()) cout << ans1[i];
	FOR(i, ans2.size()) cout << ans2[i];
	cout << endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

string str1, str2;
char s[300005], t[300005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> str1 >> str2;
	int n = str1.size();
	FOR(i, n) {
		s[i] = str1[i];
		t[i] = str2[i];
	}
	sort(s, s+n);
	sort(t, t+n);
	reverse(t, t+n);
	int ss = 0, se = (n+1)/2-1, ts = 0, te = n/2-1, ue = n-1;
	string u = s;
	FOR(i, n) {
		if (i & 1) {
			if (s[ss] <= t[ts]) u[i] = t[ts++];
			else {
				u[ue] = t[te--];
				ue--;
			}
		}
		else {
			if (s[ss] <= t[ts]) u[i] = s[ss++];
			else {
				u[ue] = s[se--];
				ue--;
			}
		}
	}
	cout << u << endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;

const int MAXN = 300010;

deque<char> oleg, egor;

string ans;
int l, r;

void Oleg()
{
	int rem = (r - l) / 2 + 1;
	while (oleg.size() > rem) oleg.pop_back();

	if (l != r && oleg.front() != oleg.back() && ((oleg.front() > egor.back() && (r - l + 1) % 2 == 0) || oleg.front() == egor.back())) {
		ans[r--] = oleg.back();
		oleg.pop_back();
	}
	else {
		ans[l++] = oleg.front();
		oleg.pop_front();
	}
}

void Egor()
{
	int rem = (r - l) / 2 + 1;
	while (egor.size() > rem) egor.pop_front();

	if (l != r && egor.front() != egor.back() && ((egor.back() < oleg.front() && (r - l + 1) % 2 == 0) || egor.back() == oleg.front())) {
		ans[r--] = egor.front();
		egor.pop_front();
	}
	else {
		ans[l++] = egor.back();
		egor.pop_back();
	}
}

int main()
{
	string input;

	cin >> input;
	sort(input.begin(), input.end());
	oleg.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		oleg[i] = input[i];
	}

	cin >> input;
	sort(input.begin(), input.end());
	egor.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		egor[i] = input[i];
	}

	l = 0, r = input.size() - 1;
	ans = string(input.size(), '?');

	bool turn = 0;
	while (l <= r) {
		(turn ^= 1) ? Oleg() : Egor();
	}

	cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;

const int MAXN = 300010;

deque<char> oleg, egor;

string ans;
int l, r;

void Oleg()
{
	int rem = (r - l) / 2 + 1;
	while (oleg.size() > rem) oleg.pop_back();

	if (l != r && ((oleg.front() > egor.back() && (r - l + 1) % 2 == 0) || oleg.front() == egor.back())) {
		ans[r--] = oleg.back();
		oleg.pop_back();
	}
	else {
		ans[l++] = oleg.front();
		oleg.pop_front();
	}
}

void Egor()
{
	int rem = (r - l) / 2 + 1;
	while (egor.size() > rem) egor.pop_front();

	if (l != r && ((egor.back() < oleg.front() && (r - l + 1) % 2 == 0) || egor.back() == oleg.front())) {
		ans[r--] = egor.front();
		egor.pop_front();
	}
	else {
		ans[l++] = egor.back();
		egor.pop_back();
	}
}

int main()
{
	string input;

	cin >> input;
	sort(input.begin(), input.end());
	oleg.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		oleg[i] = input[i];
	}

	cin >> input;
	sort(input.begin(), input.end());
	egor.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		egor[i] = input[i];
	}

	l = 0, r = input.size() - 1;
	ans = string(input.size(), '?');

	bool turn = 0;
	while (l <= r) {
		(turn ^= 1) ? Oleg() : Egor();
	}

	cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;

const int MAXN = 300010;

deque<char> oleg, egor;

string ans;
int l, r;

void Oleg()
{
	int rem = (r - l) / 2 + 1;
	while (oleg.size() > rem) oleg.pop_back();

	if (oleg.front() >= egor.back() && (r - l + 1) % 2 == 0) {
		ans[r--] = oleg.back();
		oleg.pop_back();
	}
	else {
		ans[l++] = oleg.front();
		oleg.pop_front();
	}
}

void Egor()
{
	int rem = (r - l) / 2 + 1;
	while (egor.size() > rem) egor.pop_front();

	if (egor.back() <= oleg.front() && (r - l + 1) % 2 == 0) {
		ans[r--] = egor.front();
		egor.pop_front();
	}
	else {
		ans[l++] = egor.back();
		egor.pop_back();
	}
}

int main()
{
	string input;

	cin >> input;
	sort(input.begin(), input.end());
	oleg.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		oleg[i] = input[i];
	}

	cin >> input;
	sort(input.begin(), input.end());
	egor.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		egor[i] = input[i];
	}

	l = 0, r = input.size() - 1;
	ans = string(input.size(), '?');

	bool turn = 0;
	while (l <= r) {
		(turn ^= 1) ? Oleg() : Egor();
	}

	cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;

const int MAXN = 300010;

deque<char> oleg, egor;

string ans;
int l, r;

void Oleg()
{
	int rem = (r - l) / 2 + 1;
	while (oleg.size() > rem) oleg.pop_back();

	if (l != r && ((oleg.front() > egor.back() && (r - l + 1) % 2 == 0) || oleg.front() == egor.back())) {
		ans[r--] = oleg.back();
		oleg.pop_back();
	}
	else {
		ans[l++] = oleg.front();
		oleg.pop_front();
	}
}

void Egor()
{
	int rem = (r - l) / 2 + 1;
	while (egor.size() > rem) egor.pop_front();

	if (l != r && ((egor.back() < oleg.front() && (r - l + 1) % 2 == 0) || egor.front() == oleg.back())) {
		ans[r--] = egor.front();
		egor.pop_front();
	}
	else {
		ans[l++] = egor.back();
		egor.pop_back();
	}
}

int main()
{
	string input;

	cin >> input;
	sort(input.begin(), input.end());
	oleg.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		oleg[i] = input[i];
	}

	cin >> input;
	sort(input.begin(), input.end());
	egor.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		egor[i] = input[i];
	}

	l = 0, r = input.size() - 1;
	ans = string(input.size(), '?');

	bool turn = 0;
	while (l <= r) {
		(turn ^= 1) ? Oleg() : Egor();
	}

	cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;

const int MAXN = 300010;

deque<char> oleg, egor;

string ans;
int l, r;

void Oleg()
{
	int rem = (r - l) / 2 + 1;
	while (oleg.size() > rem) oleg.pop_back();

	if (oleg.front() >= egor.back() && (r - l + 1) % 2 == 0) {
		ans[r--] = oleg.back();
		oleg.pop_back();
	}
	else {
		ans[l++] = oleg.front();
		oleg.pop_front();
	}
}

void Egor()
{
	int rem = (r - l) / 2 + 1;
	while (egor.size() > m) egor.pop_front();

	if (egor.back() <= oleg.front() && (r - l + 1) % 2 == 0) {
		ans[r--] = egor.front();
		egor.pop_front();
	}
	else {
		ans[l++] = egor.back();
		egor.pop_back();
	}
}

int main()
{
	string input;

	cin >> input;
	sort(input.begin(), input.end());
	oleg.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		oleg[i] = input[i];
	}

	cin >> input;
	sort(input.begin(), input.end());
	egor.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		egor[i] = input[i];
	}

	l = 0, r = input.size() - 1;
	ans = string(input.size(), '?');

	bool turn = 0;
	while (l <= r) {
		(turn ^= 1) ? Oleg() : Egor();
	}

	cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;

const int MAXN = 300010;

deque<char> oleg, egor;

string ans;
int l, r;

void Oleg()
{
	int rem = (r - l) / 2 + 1;
	while (oleg.size() > rem) oleg.pop_back();

	if ((oleg.front() > egor.back() && (r - l + 1) % 2 == 0) || oleg.front() == egor.back()) {
		ans[r--] = oleg.back();
		oleg.pop_back();
	}
	else {
		ans[l++] = oleg.front();
		oleg.pop_front();
	}
}

void Egor()
{
	int rem = (r - l) / 2 + 1;
	while (egor.size() > rem) egor.pop_front();

	if ((egor.back() < oleg.front() && (r - l + 1) % 2 == 0) || egor.front() == oleg.back()) {
		ans[r--] = egor.front();
		egor.pop_front();
	}
	else {
		ans[l++] = egor.back();
		egor.pop_back();
	}
}

int main()
{
	string input;

	cin >> input;
	sort(input.begin(), input.end());
	oleg.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		oleg[i] = input[i];
	}

	cin >> input;
	sort(input.begin(), input.end());
	egor.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		egor[i] = input[i];
	}

	l = 0, r = input.size() - 1;
	ans = string(input.size(), '?');

	bool turn = 0;
	while (l <= r) {
		(turn ^= 1) ? Oleg() : Egor();
	}

	cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;

const int MAXN = 300010;

deque<char> oleg, egor;

string ans;
int l, r;

void Oleg()
{
	int rem = (r - l) / 2 + 1;
	while (oleg.size() > rem) oleg.pop_back();

	if (l != r && oleg.front() > egor.back()) {
		ans[r--] = oleg.back();
		oleg.pop_back();
	}
	else {
		ans[l++] = oleg.front();
		oleg.pop_front();
	}
}

void Egor()
{
	int rem = (r - l) / 2 + 1;
	while (egor.size() > rem) egor.pop_front();

	if (l != r && egor.back() <= oleg.front()) {
		ans[r--] = egor.front();
		egor.pop_front();
	}
	else {
		ans[l++] = egor.back();
		egor.pop_back();
	}
}

int main()
{
	string input;

	cin >> input;
	sort(input.begin(), input.end());
	oleg.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		oleg[i] = input[i];
	}

	cin >> input;
	sort(input.begin(), input.end());
	egor.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		egor[i] = input[i];
	}

	l = 0, r = input.size() - 1;
	ans = string(input.size(), '?');

	bool turn = 0;
	while (l <= r) {
		(turn ^= 1) ? Oleg() : Egor();
	}

	cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;

const int MAXN = 300010;

deque<char> oleg, egor;

string ans;
int l, r;

void Oleg()
{
	int rem = (r - l) / 2 + 1;
	while (oleg.size() > rem) oleg.pop_back();

	if (l != r && oleg.front() >= egor.back()) {
		ans[r--] = oleg.back();
		oleg.pop_back();
	}
	else {
		ans[l++] = oleg.front();
		oleg.pop_front();
	}
}

void Egor()
{
	int rem = (r - l) / 2 + 1;
	while (egor.size() > rem) egor.pop_front();

	if (l != r && egor.back() <= oleg.front()) {
		ans[r--] = egor.front();
		egor.pop_front();
	}
	else {
		ans[l++] = egor.back();
		egor.pop_back();
	}
}

int main()
{
	string input;

	cin >> input;
	sort(input.begin(), input.end());
	oleg.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		oleg[i] = input[i];
	}

	cin >> input;
	sort(input.begin(), input.end());
	egor.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		egor[i] = input[i];
	}

	l = 0, r = input.size() - 1;
	ans = string(input.size(), '?');

	bool turn = 0;
	while (l <= r) {
		(turn ^= 1) ? Oleg() : Egor();
	}

	cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;

const int MAXN = 300010;

deque<char> oleg, egor;

string ans;
int l, r;

void Oleg()
{
	int rem = (r - l) / 2 + 1;
	while (oleg.size() > rem) oleg.pop_back();

	if (l != r && oleg.front() >= egor.back()) {
		ans[r--] = oleg.back();
		oleg.pop_back();
	}
	else {
		ans[l++] = oleg.front();
		oleg.pop_front();
	}
}

void Egor()
{
	int rem = (r - l) / 2 + 1;
	while (egor.size() > rem) egor.pop_front();

	if (l != r && egor.back() < oleg.front()) {
		ans[r--] = egor.front();
		egor.pop_front();
	}
	else {
		ans[l++] = egor.back();
		egor.pop_back();
	}
}

int main()
{
	string input;

	cin >> input;
	sort(input.begin(), input.end());
	oleg.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		oleg[i] = input[i];
	}

	cin >> input;
	sort(input.begin(), input.end());
	egor.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		egor[i] = input[i];
	}

	l = 0, r = input.size() - 1;
	ans = string(input.size(), '?');

	bool turn = 0;
	while (l <= r) {
		(turn ^= 1) ? Oleg() : Egor();
	}

	cout << ans << endl;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> ii;

const int MAXN = 300010;

deque<char> oleg, egor;

string ans;
int l, r;

void Oleg()
{
	if (oleg.front() >= egor.back()) {
		ans[r--] = oleg.back();
		oleg.pop_back();
	}
	else {
		ans[l++] = oleg.front();
		oleg.pop_front();
	}
}

void Egor()
{
	if (egor.back() <= oleg.front()) {
		ans[r--] = egor.front();
		egor.pop_front();
	}
	else {
		ans[l++] = egor.back();
		egor.pop_back();
	}
}

int main()
{
	string input;

	cin >> input;
	sort(input.begin(), input.end());
	oleg.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		oleg[i] = input[i];
	}

	cin >> input;
	sort(input.begin(), input.end());
	egor.resize(input.size());
	for (int i = 0; i < input.size(); i++) {
		egor[i] = input[i];
	}

	l = 0, r = input.size() - 1;
	ans = string(input.size(), '?');

	bool turn = 0;
	while (l <= r) {
		(turn ^= 1) ? Oleg() : Egor();
	}

	cout << ans << endl;
}