#include <iostream>
#include <string>
using namespace std;

 int main()
 {
 	int n, i, r;
 	string a;
 	cin >> n;
 	r = n;
 	cin >> a;
 	for (i = 0; i < n; i++)
 	{
 		if (a[i] == 'R' && a[i + 1] == 'U')
 		{
 			a[i + 1] = 'D';
 			r--;
 		}
 		if (a[i] == 'U' && a[i + 1] == 'R')
 		{
 			a[i + 1] = 'D';
 			r--;
 		}
 	}
 	cout << r;
 }

#include <cstdio>
#include <string>
#include <iostream>
using namespace std;

int main()
{
	int nsize = 0;
	scanf("%d", &nsize);
	string s;
	cin >> s;

	int ans = 0;
	int i = 1;
	while (i < nsize)
	{
		if (s[i] != s[i - 1])
		{
			ans++;
			i++;
		}
		i++;
	}
	printf("%d\n", nsize - ans);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    string s;
    cin>>s;
    int cnt=0;
    for(int i=0;i<s.size();)
    {
        if(i==s.size()-1)
        {cnt++;i++;}
        else
        {
            if((s[i]=='R' && s[i+1]=='U') || (s[i]=='U' && s[i+1]=='R'))
            {
                cnt++; i+=2;
            }
            else
            {
                cnt++;
                i++;
            }
        }
    }
    cout<<cnt;
    return 0;
}

#include<iostream>
#include<string>
using namespace std;
int main()
{
	int n,c=0;
	cin >> n;
	string s;
	cin >> s;
	for (int i = 0; i <= n - 1; i++)
	{
		if (s[i] == 'U'&& s[i + 1] == 'R' || s[i] == 'R'&& s[i + 1] == 'U')
		{
			c++;
			i++;
		}

	}
	cout << n - c << endl;

	return 0;
}

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define maxn 100010
ll a[maxn];
int n;

int main()
{

    while(cin >> n){
        int cnt = n, pos;
        string s;
        cin >> s;
        for(int i=0; i<s.size(); i++){
            if((s[i]=='R'&&s[i+1]=='U') || (s[i]=='U'&&s[i+1]=='R')){
                //pos = i;
                s.replace(i,2,"D");
            }
        }
        cout << s.size() << endl;
    }
    return 0;
}

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define maxn 100010
ll a[maxn];
int n;

int main()
{

    while(cin >> n){
        int cnt = n, pos;
        string s;
        cin >> s;
        for(int i=0; i<s.size(); i++){
            if((s[i]=='R'&&s[i+1]=='U') || (s[i]=='U'&&s[i+1]=='R')){
                pos = i;
                s.replace(pos,2,"D");
                //cout<<cnt<< " " ;
            }
        }
        cout << s.size() << endl;
    }
    return 0;
}

#include<iostream>
#include<string>
using namespace std;

int main()
{
    int n,ans;
    string s;
    cin>>n;
    cin>>s;
    ans=n;
    for(int i=0;i<n-1;++i)
    {
        if(s[i]=='R'&&s[i+1]=='U'||s[i]=='U'&&s[i+1]=='R')
        {
            --ans;
            s[i+1]='D';
        }
    }
    cout<<ans<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
char s[105];
int re[105];
int main ()
{
	int n;
	scanf("%d",&n);
	scanf("%s",s);
	int cnt1=0,cnt2=0;
	for(int i=1;i<n;i++)
	{
		if(s[i]!=s[i-1]&&!re[i-1]) cnt1++,re[i]=1;
	}
	printf("%d",n-cnt1);
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main()
{
   int n;
   cin>>n;
   string str;
   cin>>str;
   int total=0;
   int i=0;
   while(i<n){
        if(str[i]!=str[i+1]){
            i=i+2;
        }
        else i=i+1;
        total++;
   }
   cout<<total;
}

#include <bits/stdc++.h>

using namespace std;
string a;
int main()
{
    int n,ans;
    cin >> n;
    cin >> a;
    ans=n;
    for(int i=0;i<n;i++)
    {
        if(i==0) continue;
        if(a[i]!=a[i-1])
        {
            ans--;
            i++;
            continue;
        }
    }
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

char s[150];

int main() {
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    while (cin >> n) {
        cin >> s;
        int cnt = 0;
        int i = 0;
        while (i < n) {
            if ( (s[i] == 'R' && s[i+1] == 'U') || (s[i] == 'U' && s[i+1] == 'R') ) {
                cnt++;
                i += 2;
            } else {
                i++;
            }
        }
        cout << n - cnt << endl;
    }
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef long long ll;

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T readNxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc()); x*=f;
    return x;
}
string s;
ll n,m,k,x,y;

void solve()
{ cin>>n;
 cin>>s;
 ll nb = 0 ;
 for(int i=0;i<s.size()-1;i++)
    if((s[i]=='U' && s[i+1]=='R') || (s[i+1]=='U' && s[i]=='R')) nb++,i++;

 cout<<s.size()-nb;

}

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

   //freopen("out.txt","w",stdout);
  // freopen("test.in","r",stdin);

  solve();

    return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define st string
#define ch char
#define ld long double
using namespace std;
int main()
{
	ll a=0,c=0;
	st b;
	cin>>a>>b;
	for (ll i=1;i<a; i++)
	{
		if(b[i]!=b[i-1])
	 	{
	 		i++;
			c++;
		}
	}
	cout<<a-c;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    string s;
    int ans;

    cin >> n >> s;
    ans = n;
    for(int i = 0; i< (n - 1);i++){
        if(s[i] != s[i + 1]){
            i++;
            ans--;
        }
    }
    cout << ans;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
 	int n;
 	cin >> n;
 	string s;
 	cin >> s;
 	int ans = 0;
 	for (int i = 0; i < n - 1; i++) {
 		if ((s[i] == 'U' && s[i+1] == 'R') || (s[i] == 'R' && s[i+1] == 'U')){
 			ans ++; i++;
 		}
 	}
 	cout << n - ans;
}

#include <bits/stdc++.h>

#define ll long long
#define ii pair<int,int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define sf(x) scanf("%d", &x)
#define sf2(x,y) scanf("%d %d", &x, &y)

#define inf 100000000
#define N 1005
using namespace std;

int main(){
	int n;
	string a;
	cin >> n >> a;
	int ans = 0;
	map<char,int> mp;
	mp['R'] = 0;
	mp['U'] = 1;
	for(int i = 0; i < a.size(); i++){
		if(i == a.size()){
			ans++;
			break;
		}
		if(mp[a[i]] == !mp[a[i+1]]) i++;
		ans++;
	}
	cout << ans << endl;

}

#include <iostream>
#include <string>
#include <cstdio>
using namespace std;

int main()
{
#ifdef MY_DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int n = 0;
  cin >> n;
  string s;
  cin >> s;
  int k = 0;
  for (int i = 0; i < n - 1; i++)
  {
    if (s[i] != s[i + 1])
    {
      k++; i++;
    }
  }
  cout << n - k;

  return 0;
}

#include <iostream>
#include <string>

int solve(const int& n, const std::string& s)
{
    int counter = 0;
    for(int i = 0; i < n - 1; ++i)
    {
        if((s[i] == 'R' && s[i + 1] == 'U') || (s[i] == 'U' && s[i + 1] == 'R'))
        {
            ++counter;
            ++i;
        }
    }
    return n - counter;
}

int main()
{
    int n;
    std::string s;
    std::cin >> n >> s;
    std::cout << solve(n, s) << std::endl;
    return 0;
}

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

int main(){
	int n;cin>>n;
	string s;
	cin>>s;

	int k=0;
	for(int i=0;i<s.length();i++){
		if((s[i]=='U'&&s[i+1]=='R')||(s[i]=='R'&&s[i+1]=='U'))
			i++;

		++k;
	}
	cout<<k<<endl;
}

#include<iostream>
using namespace std;
int main(){
    int a=0,n,i;
    cin>>n;
    string s;
    cin>>s;
    for(i=1; i<=n; i++)
    {
             if(s[i]=='U' && s[i-1]=='R')
             {
                          a=a+1;
                          i=i+1;
             }
             else if(s[i]=='R' && s[i-1]=='U')
             {
                          a=a+1;
                          i=i+1;
             }
    }
    cout<<n-a;
    return 0;
}

/*
 * socode.online
 *
 * Author: 李策
 * E-mail: 691397536@qq.com
 * Time  : 2020-04-18 21:33:09
 */
#include <bits/stdc++.h>

using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))

typedef long long ll;

int main() {
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
//	ios::sync_with_stdio(false);
//	cin.tie(0);
    int n; string s;
    cin >> n >> s;
    int len = s.size(), ans = 0;
    for( int i = 0; i < len; i++ ) {
    	if( s[i] != s[i+1] ) ans++, i++;
    	else ans++;
	}
	cout << ans << endl;
	return 0;
}

#include<bits/stdc++.h>
#define IO ios::sync_with_stdio(false);\
    cin.tie(0);\
    cout.tie(0);
using namespace std;
typedef long long LL;
const int maxn = 1e5+10;

int n;
char str[maxn];
int main()
{
    IO;
    cin>>n;
    cin>>str;
    int ans=0;
    for(int i=1;i<n;i++)
    {
        if(str[i]!=str[i-1])
            ans--,i++;

    }
    cout<<n+ans<<endl;
    return 0;
}

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n;
	cin>>n;
	char s[100+5];
	for(int i=0;i<n;i++)
	cin>>s[i];
	int cnt=n;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='U'&&s[i+1]=='R')
		{
			cnt--;i++;
		}
		else if(s[i]=='R'&&s[i+1]=='U')
		{
			cnt--;i++;
		}
	}
	cout<<cnt;
}

#include<iostream>
#include<stdio.h>
using namespace std;

int main()
{
    char a[100],b[100];
    int n,i,j=0;
    cin>>n;
    scanf("%s",a);
    b[0]=a[0];
    for(i=1;i<n;i++)
    {
       if(b[j]=='R'&&a[i]=='U'||a[i]=='R'&&b[j]=='U')
        b[j]='D';
       else
       {
           j++;
           b[j]=a[i];
       }
    }
    cout<<j+1;
    return 0;
}

#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std;
char s[1000];
int i,j,k=0,m,n,a[100000];
int main()
{
	cin>>n;
	cin>>s;
	i=0;
	while(i<n-1)
	{
		if(s[i]!=s[i+1])
		{
			i+=2;
			k++;
		}
		else
			i++;
	}
	cout<<n-k<<endl;
	//system("pause");
	return 0;
}

#include <iostream>
using namespace std;
void main()
{
	int a,cnt;
	char b;
	bool r=false,u=false;
	cin >> a;
	cnt=a;
	for (int i=0;i<a;i++)
	{
		cin >> b;
		if (b=='U')
			u=true;
		else
			r=true;
		if (u && r)
		{
			u=false;
			r=false;
			cnt--;
		}
	}
	cout << cnt;
}

/*I shall rise*/
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) f(i,0,n)
#define charan int main()
#define vi vector< int >
#define vl vector< ll >
#define mod (1000*1000*1000+7)
#define ll long long
#define pb push_back
#define mp make_pair
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define sz(a) a.size()
#define pqueue priority_queue< ll >
#define ff first
#define min(a,b) (a<b)?a:b
#define max(a,b) (a>b)?a:b
#define ss second
#define gdb(n) cout<<">>"<<n<<"<<"<<endl
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setprecision - cout << setprecision (4) << f << endl; Prints x.xxxx
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
charan
{
	fast;
	ll n;cin>>n;string s;cin>>s;
	ll cou=0,coa=0;
	for (int i = 0; i < s.length()-1; ++i)
	{
		if((s[i]=='U' && s[i+1]=='R')||(s[i]== 'R' && s[i+1]=='U'))
			{
				s[i+1]='A';
				cou++;
			}
		//cou++;
	}

	cout<<n-cou;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define F(i, L, R) for (int i = L; i < R; i++)
#define FE(i, L, R) for (int i = L; i <= R; i++)
#define FF(i, L, R) for (int i = L; i > R; i--)
#define FFE(i, L, R) for (int i = L; i >= R; i--)
int main()
{
    int n;
    string str;
    cin >> n >> str;
    string newStr = "";

    F(i, 0, n)
    {
        if (i < n - 1)
        {
            if ((str[i] == 'U' && str[i + 1] == 'R') || (str[i] == 'R' && str[i + 1] == 'U'))
            {
                newStr += "D";
                ++i;
                continue;
            }
            newStr += str[i];
            continue;
        }
        newStr += str[n - 1];
    }

    // cout << newStr << "\n";
    cout << newStr.length() << "\n";

    return 0;
}

#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main()
{
        int n;cin>>n;
        char str[n+1];
        cin>>str;
        int m=0,ans=0;
        while(m!=n-1)
        {
            if(str[m]!=str[m+1])
            {
                ans++;m+=2;
                if(m>=n-1)
                {
                    break;
                }
                m--;
            }
            m++;
        }
        cout<<n-ans<<endl;
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
using namespace std;

char s[500];
int n,ji;
int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	for(int i=1;i<=n;i++)
	{
		if(s[i]=='U')
		{
			if(s[i+1]=='R')
			{
				ji++;
				i++;
			}
		}
		else if(s[i]=='R')
		{
			if(s[i+1]=='U')
			{
				ji++;
				i++;
			}
		}
	}
	printf("%d\n",n-ji);
	return 0;
}

#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define INF 0x3f3f3f3f3f3f3f3fLL

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

template<typename T> inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T, class T1>inline void gn(T &x, T1 &y) {gn(x); gn(y);}

template<class T, class T1, class T2>inline void gn(T &x, T1 &y, T2 &z) {gn(x); gn(y); gn(z);}

template<typename T> inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<typename T> inline void println(T x) {print(x), putchar('\n');}

template<typename T> inline void printsp(T x) {print(x), putchar(' ');}

template<class T, class T1> inline void print(T x, T1 y) {printsp(x), println(y);}

template<class T, class T1, class T2> inline void print(T x, T1 y, T2 z) {printsp(x), printsp(y), println(z);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

char s[111];

int dp[111][2];

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n;

	gn(n);

	scanf("%s", s+1);

	for(int i=1; i<=n; i++){

		if(i>1 && s[i]!=s[i-1]) smax(dp[i][1], dp[i-2][0]+1);

		dp[i][0]=max(dp[i-1][0], dp[i][1]);

	}

	println(n-dp[n][0]);

	return 0;

}

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
	int n;
	string s;
	cin >> n;
	cin >> s;
	int size = s.size();

	for (size_t i = 0; i < s.size(); i++)
	{
		if ((s[i] == 'R' && s[i + 1] == 'U') || (s[i] == 'U' && s[i + 1] == 'R'))
		{
			size = size - 1;
			i++;
		}
	}
	cout << size << endl;

	return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  int i,n,k=0;
  cin>>n>>s;
  for(i=1; i<n; i++)
    if(s[i]=='R'&&s[i-1]=='U'||s[i]=='U'&&s[i-1]=='R'){
      s[i]='D';
      k++;
   }
  //cout<<s<<endl;
  cout<<n-k;
  return 0;
 }

#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <math.h>

using namespace std;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, kol;
	cin >> n;
	kol = n;
	char *a;
	a = new char[n];
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n-1; i++)
	{
		if (((a[i] == 'R') && (a[i+1] == 'U'))||((a[i] == 'U') && (a[i+1] == 'R')))
		{
			kol--;
			i++;
		}
	}
	cout << kol;

}

#include <iostream>
#include <cstdio>

using namespace std;

int main() {
	int x,n;char s[300];
	scanf("%d\n",&x); n=x; for(int i=3;i<=n+2;i++) {
		scanf("%c",&s[i]);  while(s[i]!='U' && s[i]!='R'){ i--; continue; }
		if((s[i]=='U' && s[i-1]=='R') || (s[i]=='R' && s[i-1]=='U')) s[i]='D',x--;
	}
	cout<<x<<endl;
}

//i
#include <bits/stdc++.h>
#define ms0(x) memset(x,0,sizeof(x))
#define msinf(x) memset(x,0x3f,sizeof(x))
using namespace std;
const int inf=0x3f3f3f3f;
typedef long long ll;
string s;
char ans[1005];
int n;
int main()
{
    cin>>n;
    cin>>s;
    int cnt=0;
    for(int i=0;i<s.size();){
        if((s[i]=='U'&&s[i+1]=='R')||(s[i]=='R'&&s[i+1]=='U')){
            ans[cnt++]='D';
            i=i+2;
        }
        else{
            char c=s[i];
            ans[cnt++]=c;
            i++;
        }
    }
    cout<<cnt<<endl;

    return 0;
}

    #include <iostream>
    #include <cstring>
    #include <cstdio>
    using namespace std;
    int main()
    {
      int n;
      char str[105];
      scanf("%d",&n);
      scanf("%s",str);
      int sum = 0;
      for(int i=0;i<n;i++){
        if(str[i] != str[i+1]){
          i++;
        }
        sum++;
      }
      printf("%d\n",sum);
      return 0;
    }

#include <iostream>
using namespace std;
int main()
{
    int n,k;
    char p[101];
    cin>>n;
    k=n;
    for(int z=0;z<n;z++)
    {
        cin>>p[z];
    }
    for(int i=0;i<n;i++)
    {
        if(p[i]=='R' && p[i+1]=='U')
        {k-=1;i++;}
        else if(p[i]=='U' && p[i+1]=='R')
        {k-=1;i++;}
    }
    cout<<k<<endl;
    return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int n,c=0;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<n;i++)
    {
        if((s[i]=='R'&&s[i+1]=='U')||(s[i]=='U'&&s[i+1]=='R'))
        {
            c++;
            s[i+1]='D';
        }
    }
    cout<<n-c<<endl;
    return 0;
}

#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main()
{
    int n,i,moves,r,j,u,cnt;
    moves=0;
    char s[105];
    scanf("%d",&n);
    scanf("%s",s);
    cnt=0;
    //u=0;r=0;
    for(i=1;i<n;i++){

        if(s[i]!=s[i-1])
            {
            i++;
            cnt++;
        }
    }
    printf("%d",(n-cnt));
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
	int n;
	cin >> n;
	string s;
	cin >> s;
	int cnt = 0;
	for (int i = 1; i < n; i++) {
		if (s[i] != s[i - 1]) {
			cnt++;
			i++;
		}
	}
	cout << n - cnt;
	return 0;
}

/*
�����׹�������2 d�ɻ����ߡ����������ӻ���ȷ�ġ������һϵ���׹������ľٶ�������Ϊ�������̫����,�������������̡ܶ�
����
�����ڸ�������������������U���ƶ��������ַ�R .�׹�����?���Դ����κ�һ�������ƶ����Ļ���ĶԽ����ƶ�(��Ϊ�ַ�D)��

	֮��,�����Լ�����һЩ���������Ʒ,ֱ��û��һ˫�����������Ļ�����뿪��
����
������������Ǵ�ӡ����̳��������滻��Ķ�����
����
��������
��������ĵ�һ�а���һ������n(1��n��100)-���еĳ��ȡ��ڶ��а���n����������ַ�U��R��
����
�������
������ӡ����̳��ȵ������滻����ȫ�����������ƶ���
*/
#include<iostream>
char a[110];
using namespace std;
int main()
{
	int n,x;
	cin>>n;
	x=n;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=1;i<n;i++)
	{
		if(a[i]!=a[i-1])
		{
			x--;i++;
		}
	}
	cout<<x<<endl;
	return 0;
}

#include<iostream>
#include<string>
#include<cmath>
using namespace std;

int main()
{
	int n;
	string s;

	cin>>n>>s;
	for(int i=0;i<s.size()-1;)
	{
		if(s[i]=='R' && s[i+1]=='U')
		{
			n--;
			i+=2;

		}
		else if(s[i]=='U' && s[i+1]=='R')
		{
			n--;
			i+=2;

		}
		else
			i++;
	}

	cout<<n<<endl;
}

#include <bits/stdc++.h>

using namespace std;

int n;
string S;

int main()
{
    cin >> n >> S;
    int res = 0;
    for (int i = 0; i < S.size() - 1; i++)
    {
        if (S[i] != S[i + 1])
        {
            res++;
            i++;
        }
    }

    cout << n - res << '\n';
    return 0;
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main(){
	int a;
	char b[110];
	while(~scanf("%d",&a)){
		getchar();
		int ans = 0;
		gets(b);
		for(int i = 1;i < a;i++){
			if(b[i] != b[i - 1]){
				ans++;
				i++;
			}
		}
		printf("%d\n",a - ans);
	}
	return 0;
}

#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a;
    b=a;
    char p[a];
    for(int j=0;j<a;j++)
    {
        cin>>p[j];

    }
    for(int i=0;i<a;i++)
    {
        if(i==a)
           cout<<"sadasd";
        if((p[i]!=p[i+1]))
           {
               b--;i++;
           }
           c=i;

    }
    if(c==a)
    {
        b++;
    }
    cout<<b;
}

#include<bits/stdc++.h>
using namespace std;
int main(void)
{
    int n;
    cin>>n;
    string s;
    cin>>s;
   // int l=s.length();
    for(int i=1;i<n;i++)
    {
        if(s[i]=='R' && s[i-1]=='U' ) {
                s[i]='D';
                s[i-1]='D';
        }
        else if( s[i]=='U' && s[i-1]=='R'){
                s[i]='D';
                s[i-1]='D';
        }
    }
    //cout<<s;
   int count=0;
   for( int i=0;i<n;i++)
   {
       if(s[i]=='D') count++;
   }
   count =count/2;
   cout<<n-count;
}

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

int main()
{
    int n;
      cin>>n;

        string ss;
        cin>>ss;
        stack<char>s;
        for(int i=0;i<n;i++)
        {
            if(s.empty())
            {
                s.push(ss[i]);
                continue;
            }
            if(s.top()=='R'&&ss[i]=='U'||s.top()=='U'&&ss[i]=='R')
            {
                s.pop();
                ss[i]='D';
            }
            s.push(ss[i]);
        }

        cout<<s.size()<<endl;

    return 0;
}

// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include<bits/stdc++.h>

using namespace std;

#define int long long
#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll N=1e5+10,M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
const int INF=1e9+7;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}

int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
//assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}

int n;
string s;

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    cin >> s;
    int a=0,b=0;
    string ans="";
    for(int i=0; i<n; i++){
        if(i<n-1 && s[i]=='U' && s[i+1]=='R'){
            ans+='D';
            i++;
        }
        else if(i<n && s[i]=='R' && s[i+1]=='U'){
            ans+='D';
            i++;
        }
        else ans+=s[i];
    }
    cout << ans.size();
    return 0;
}

#include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	char a[1005];
	int num = 0, flag = 0;
	for(int i = 0;i < n; i++){
		cin >> a[i];
	}
	int nn = 0;
	a[n] = a[n-1];
	for(int i = 0;i < n; i++){
		if(a[i] == 'R'||a[i] == 'U'){
			if(a[i]!=a[i+1]){
				num++;
				i+=1;
			}else{
				nn++;
			}
		}
	}
	cout << num + nn << endl;
	return 0;
}

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<memory.h>
#include<string.h>
#include<math.h>
using namespace std;
typedef long long ll;
int n;
char m[105];
int dp[105][2];
int main(){
	while(~scanf("%d",&n)){
//		fflush(stdin);
	scanf("%s",&m);
	dp[0][0]=1;
	dp[0][1]=1;
	for(int i=1;i<n;i++){
		if(m[i]!=m[i-1]){
			dp[i][1]=dp[i-1][0];
			dp[i][0]=min(dp[i-1][0]+1,dp[i-1][1]+1);
		}
		else{
			dp[i][1]=dp[i][0]=min(dp[i-1][0]+1,dp[i-1][1]+1);
		}
	}
	printf("%d\n",min(dp[n-1][0],dp[n-1][1]));
	}

	return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, int> psi;

#define ff first
#define ss second
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define d(a,b,c,d) cout<<a<<' '<<b<<' '<<c<<' '<<d<<'\n'
#define IO ios_base::sync_with_stdio(0);cin.tie(0);

int main()
{
    int n; cin >> n;
    string s; cin >> s;
    int cnt = 0;
    for(int i = 0; i < n-1; i++)
        if(s[i] != s[i+1])
        {
            cnt++;
            i++;
        }
    cout << n-cnt << endl;
    return 0;
}

#include <bits/stdc++.h>
#define lld long long int
#define pb push_back
#define pp pop_back
using namespace std;
int main(){
	int a,u=0,r=0,ans=0;
	string m;
	cin>>a>>m;
	vector<int>g,h;
	r=a;
	for(int i=0;i<a;i++){

	if(m[i]=='U'&&m[i+1]=='R'||m[i]=='R'&&m[i+1]=='U'){
		u++;
		i++;
	}
	}

	cout<<a-u;
	/*for(int i=0;i<min(h.size(),g.size())-1;i++){
		ans+=max(g[i],h[i])-abs(g[i]-h[i]);
	}
	//cout<<ans<<endl;
	cout<<a-ans;*/
	return 0;
}

#include<iostream>
using namespace std;
int main(){
    string a;
    int n,k=0;
    cin>>n;
    cin>>a;
    int i=0;
    while(i<n-1)
     {
		  if(a[i]=='U'&& a[i+1]=='R'||a[i+1]=='U'&& a[i]=='R'){
            k++;
            i=i+2;
        }
        else i++;
    }
    int e;
    e=n-k;
    cout<<e;
}

#include<bits/stdc++.h>
using namespace std;
int n,k;
string s;
main(){
cin>>n>>s;
if(s=="UR"||s=="RU"){cout<<1;return 0;}
for(int i=0;i<s.size()-1;i++){
    if(s[i]=='U'&&s[i+1]=='R'){s.erase(i,2);k++;i--;}
    else if(s[i]=='R'&&s[i+1]=='U'){s.erase(i,2);k++;i--;}

}
cout<<s.size()+k;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, cnt = 0;
    string dir;
    cin>>n>>dir;
    for (int i=0; i<n-1; i++){
        if ((dir[i] == 'U' && dir[i+1] == 'R' ) || (dir[i] == 'R' && dir[i+1] == 'U')){
            cnt++;
            i++;
        }
    }
    cout << dir.length()- cnt <<endl;
    return 0;
}

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

#define MAXN 110
int n;
char s[MAXN];

int main()
{
	while(~scanf("%d%s",&n,s))
	{
		int ans=n;
		for(int i=0;i<n-1;i++)
		{
			if((s[i]=='U'&&s[i+1]=='R')||(s[i]=='R'&&s[i+1]=='U'))
				ans--,i++;
		}
		printf("%d\n",ans);
	}
	return 0;
}

#include<iostream>
#include<cstdio>
using namespace std;
int main ()
{
  int n;
  char a[101];
  int ans = 0;
  scanf("%d",&n);
  scanf("%s",a);
  for(int i = 0;i<n;i++)
  {
     if((a[i] == 'U'&&a[i+1] == 'R')||(a[i] == 'R'&&a[i+1] == 'U'))
        {
             ans++;
             i++;
        }
  }
  printf("%d",n-ans);
  return 0 ;
}

#include<iostream>
#include<string>
int main() {
	std::string data;
	int n;
	std::cin >> n;
	data.reserve(n);
	std::cin >> data;
	int count = 0;
	for (int i = 0, size = data.size(); i < size;) {
		if (data[i] == 'R' && data[i + 1] == 'U' ||
			data[i] == 'U' && data[i + 1] == 'R') {
			++count; i += 2;
		}
		else {
			i++; count++;
		}
	}

	std::cout << count << std::endl;

	//system("pause");
}

#include <iostream>
#include <string>
using namespace std;
int main(){
	int n,sum=0;
	string s;
	cin>>n>>s;
	for(int i=0; i<n; i++){
		if(s[i]!=s[i+1]) i++;
		sum++;
	}
	cout<<sum;
}

	#include <iostream>
	#include <math.h>
	#include <algorithm>
	#include <vector>
	#include <string>
	#include <map>
	#include <stack>
	#include <cstdio>
	#include <random>
	#include <queue>

	using namespace std;

	#define x first
	#define y second
	#define mp make_pair
	#define endl '\n'

	typedef long long li;
	typedef double ld;

	const int INF = 1e9;
	const long long INF64 = 1e18;
	const int MOD = INF + 7;
	const long long EPS = 1e-9;

	int main() {
		ios_base::sync_with_stdio(false);

		int n, ans = 0;
		string s;

		cin >> n >> s;

		for (int i = 0; i < n; i++) {
			if ((s[i] == 'R' && s[i + 1] == 'U') || (s[i] == 'U' && s[i + 1] == 'R'))
				i++;
			ans++;
		}

		cout << ans;

		//system("pause");
		return 0;
}

#include<iostream>
#include<string>
using namespace std;
int main()
{
    int n,s=0;
    string a;
    cin>>n;
    cin>>a;
    int j=0;
    while(j<n-1){
        if(a[j]!=a[j+1])
        {
            s++;j+=2;
        }
        else j++;
    }
    cout<<n-s<<endl;
   return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;int n;
	cin>>n;
	cin>>s;int ans=s.length();
	for(int i=0;i<s.length()-1;i++) if(s[i]!=s[i+1]) ans--,i++;
	cout<<ans;
	return 0;
}//fcyakking

#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<set>
#include<map>
#include<string>
using namespace std;
int main() {
	int n;
	string str;
	cin >> n;
	cin >> str;
	int i = 0, c = 0;
	while (i < n) {
		if (((str[i] == 'U') && (str[i + 1] == 'R')) || ((str[i] == 'R') && (str[i + 1] == 'U'))) {
			c++;
			i++;
		}
		i++;
	}
	cout << n - c;
	return 0;
}

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<queue>
using namespace std;
#define LL long long
#define RG register
#define il inline
#define lc (o<<1)
#define rc ((o<<1)|1)
#define mid ((l+r)>>1)
inline int rd()
{
    RG int x=0,t=1;RG char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if(ch=='-')t=-1,ch=getchar();
    while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
    return x*t;
}
char cc[110];
int n,ans;
int main()
{
  //freopen("xzz.in","r",stdin);
  //freopen("xzz.out","w",stdout);
  ans=n=rd();cin>>cc;
  for(int i=0;i<n-1;i++)
    if(cc[i]!=cc[i+1]) {i++;--ans;}
  cout<<ans;
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,cnt;char a[1001];
	cin>>n;cnt=n;
	for(int i=1;i<=n;i++)cin>>a[i];
	while(cnt>=0){
		if((a[cnt]=='U'&&a[cnt-1]=='R')||(a[cnt]=='R'&&a[cnt-1]=='U')){cnt-=2;n-=1;}
		else cnt-=1;
	}
	cout<<n<<'\n';
}

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

int main()
{
    string s;
    int n, summ{};
    cin >> n >> s;
       for (int i=0; i<n; i++) if (s[i+1]!=s[i] && i!=n-1) { summ++; i++; }
       summ=n-summ*2+summ;
    cout << summ;
}

#include<iostream>
#include<cmath>

using namespace std;

int n;
int ans;
char a[100100];
int main(){
	cin >>n;
	cin >>a;
	for(int i=0;i<n;i++){
		if(a[i]=='U'&&a[i+1]=='R'){
			i++;
			ans++;
		}
		else if(a[i]=='R'&&a[i+1]=='U'){
			i++;
			ans++;
		}
		else ans++;
	}
	cout <<ans <<endl;
	return 0;
}

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
	int x;
	cin >> x;
	string s;
	vector <char>v;
	cin >> s;
	for (int i = 0; i < x; i++)
	{
		if (s[i] == 'R'&&s[i + 1] == 'U')
		{
			v.push_back('D');
			i++;
		}
		else if (s[i] == 'U'&&s[i + 1] == 'R')
		{
			v.push_back('D');
			i++;
		}
		else
			v.push_back(s[i]);
	}
	cout << v.size();
	return 0;
}

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

    int n;
    string s;
    stack<char> ans;

    int main(){
        ios_base::sync_with_stdio(0);
        cin.tie(0);

        cin >> n >> s;
        for(auto e:s){
            if(ans.empty()){
                ans.push(e);
            }else{
                if(ans.top() == 'R' && e == 'U'){
                    ans.pop();
                    ans.push('D');
                }else if(ans.top() == 'U' && e == 'R'){
                    ans.pop();
                    ans.push('D');
                }else{
                    ans.push(e);
                }
            }
        }
        cout << ans.size() << '\n';

        return 0;
    }

#include<bits/stdc++.h>
using namespace std;
int dp[105];
int rec(string s, int id)
{
	if(id >= s.size()-1) {
		return 0;
	}
	if(dp[id] != -1) {
		return dp[id];
	}
	if(s[id] == s[id+1]) {
		dp[id] =  rec(s, id+1);
	} else {
		dp[id] =  max(rec(s, id+1), 1+rec(s, id+2));
	}
	return dp[id];
}
int main()
{
	memset(dp, -1, sizeof(dp));
	string str;
	int n;
	scanf("%d", &n);
	cin>>str;
	int ans = rec(str, 0);
	ans = str.size() - ans;
	printf("%d\n", ans);
}

#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,c=0;
	cin>>a;
	string b;
	cin>>b;
	for(int i=0;i<b.size();i++){
		if(b[i]!=b[i+1]&&i!=b.size()-1){
			c++;
			i++;
		}
	}
	cout<<a-c;
}

/**
 *    author:  Zheksenov Ramazan
 *    created: 22.03.2018
**/

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>

#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>

#include <string>
#include <ctime>
#include <queue>
#include <stack>

#include <vector>
#include <map>
#include <set>
#include <deque>

#include <cassert>
#include <unordered_map>
#include <bitset>
#include <unordered_set>

using namespace std;

#define pb push_back
#define pp pop_back
#define f first
#define s second
#define mp make_pair
#define sz(a) (int)((a).size())
#ifdef _WIN32
#  define I64 "%I64d"
#else
#  define I64 "%lld"
#endif
#define fname "."

void freeopen() {
	#ifndef ONLINE_JUDGE
	freopen(fname".in", "r", stdin);
	freopen(fname".out", "w", stdout);
	#endif
}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pi;
typedef pair < int, ull > pu;
typedef pair < ll, ll > pl;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
int dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

const int inf = (int)1e9 + 123;
const ll infl = (ll)1e18 + 123;
const double eps = 1e-9;

const int MAX_N = (int)5e5 + 5;
const int mod = (int)1e9 + 7;

int n, c;
string s;

int main() {

    setlocale(0, "");

	//#ifdef DEBUG
	//    freopen("input.txt", "r", stdin);
	//#endif

	ios_base::sync_with_stdio(0);
    cin.tie(0);

	cin >> n >> s;
	int i = 1;
	while (i < n){
	if (s[i]!=s[i-1]) {
		c++;
		i++;
}
	i++;
}
	cout << n - c;

	#ifdef _DEBUG
		cerr << "TIME = " << clock() - tt << " ms\n";
		tt = clock();
	#endif

	return 0;
}

#include<bits/stdc++.h>
#define pb push_back
#define x first
#define y second
using namespace std;
using DO=double;
using INT=long long;
using pii=pair<int,int>;
using pi3=pair<pii,int>;
template<typename T,typename U> inline void smin(T &a,const U &b) {if(a>b) a=b;}
template<typename T,typename U> inline void smax(T &a,const U &b) {if(a<b) a=b;}
int power(int a,int b,int mod,int ans=1){
	for(;b;b>>=1,a=1LL*a*a%mod) if(b&1) ans=1LL*ans*a%mod;
	return ans;
}
char s[100100];
int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n;scanf("%d",&n);
	scanf("%s",s);
	int ans=0;
	for(int i=0;i<n;i++){
		if(s[i]=='R' and s[i+1]=='U') i++;
		else if(s[i]=='U' and s[i+1]=='R') i++;
		ans++;
	}
	cout<<ans<<endl;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n, t=0;
    cin>>n;
    string s;
    cin>>s;
    for(int i=0;i<s.length();i++){
        if(s[i]!=s[i+1]){
            t++;
            i+=1;
        }
        else t++;
    }
    cout<<t;

    return 0;
}

/**
 *  author: Behradm
 *  Created: 2020.08.10 12:01:23
 *  In The Name Of God
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;

  int res = 0;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] != s[i + 1]) {
      res += 1;
      i += 1;
    }
  }
  cout << n - res << '\n';
  return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    char s[110];
    while(scanf("%d",&n)!=EOF)
    {
        getchar();
        int count=0;
        for(int i=0; i<n; i++)
            scanf("%c",&s[i]);
        for(int i=0; i<n; i++)
        {
            if((s[i]=='R'&&s[i+1]=='U') || (s[i]=='U'&&s[i+1]=='R' ))
            {
                count++;
                s[i]='0';
                s[i+1]='0';
            }
            else
                continue;
        }
        for(int i=0; i<n; i++)
        {
            if(s[i]!='0')
                count++;
            else
                continue;
        }
        printf("%d\n",count);
    }
    return 0;
}

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

int main()
{
    int n;
    cin>>n;
    string a;
    cin>>a;
    while(a.find("UR")!=string::npos||a.find("RU")!=string::npos)
    {
        if(a.find("UR")<a.find("RU"))
           a.replace(a.find("UR"),2,"D");
        else
           a.replace(a.find("RU"),2,"D");
    }
    cout<<a.size()<<endl;
    return 0;
}

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

int main()
{
    int m;
    cin>>m;
    string s;

    cin>>s;

    vector<char> v;
    for(int i=0;i<m-1;i++)
    {
       if(s[i]!=s[i+1])
       {
           v.push_back('D');
           i++;
           if(i==m-1)
           {
               cout<<v.size()<<endl;
               return 0;
           }
       }
       else
       {
           v.push_back(s[i]);

       }
    }
    cout<<v.size()+1<<endl;
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <malloc.h>
#include <ctype.h>
#include <math.h>
#include <string>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <deque>
#include <set>
#include <map>
using namespace std;

const int maxn = 1000;
char strmap[maxn][maxn];

int main()
{
	int N;
	char str[200];
	cin >> N;
	cin >> str + 1;
	int temp = N;
	for(int i = 1;i <= temp;i++)
	{
		if(str[i] == 'U' && str[i -1] == 'R')
			N -= 1;
		else if(str[i] == 'U' && str[i + 1] == 'R')
		{
			N -= 1;
			str[i + 1] = 'D';
		}
	}
	cout << N << endl;
}

#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
long long n;
string s;
int main() {
	cin >> n;
	cin >> s;
	long long sum = n;
	for(int i = 0; i<n-1;i++) {
		if(s[i]!=s[i+1]) {
			sum--;
			i++;
		}
	}
	cout << sum << endl;
	return 0;
}

#include<iostream>
using namespace std;
int main()
{
       int n,i,c=0;
       cin>>n;
       string s;
       cin>>s;
       i=1;
       while(i<n)
       {
              if((s[i]=='R'&&s[i-1]=='U')||(s[i]=='U'&&s[i-1]=='R'))
              {
                     c++;
                     i+=2;
              }
              else i++;
       }
       cout<<n-c;
       return 0;
}

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

int main(){
    int n;
    cin>>n;
    string a;
    cin>>a;
    int len=n;
    for(int i=0;i<n-1;i++){
        if(a[i]!=a[i+1]){
            len--;i++;
        }
    }
    cout<<len<<endl;
}

// Adil.

#include <iostream>
#include <sstream>

#include <math.h>
#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <cstring>

#include <cstdio>
#include <cstdlib>

#include <vector>
#include <set>
#include <map>

typedef long long ll;
typedef unsigned long long ull;

#define fname ""
#define problemName ""
#define ios_ssync ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define pb push_back
#define pop pop_back

#define F first
#define S second

#define sqr(x) x * 1ll * x
#define cb(x) sqr(x) * 1ll * x

#define pii pair <int, int>
#define pll pair <ll, ll>

#define size(x) x.size()
#define all(x) x.begin(), x.end()
#define show(x) cerr << #x << " = " << x << ", "
#define showln(x) cerr << #x << " = " << x << endl

using namespace std;

void freeopen() {
	#ifndef ONLINE_JUDGE
	freopen(fname".in", "r", stdin);
	freopen(fname".out", "w", stdout);
	#else
	freopen(fname".in", "r", stdin);
	freopen(fname".out", "w", stdout);
	#endif
}

const int D = 1e6 + 1;
const int inf = (int) (1u << 31) - 1u;
const ll INF = (ll) (1ull << 63) - 1ull;
const int N = 1e5 + 1;
const int E = 1e3 + 1;
const int edge = 1e9 + 9LL;
const int mod = 1e9 + 7ll;

const int dx[] = {+1, -1, 0, 0};
const int dy[] = {0, 0, +1, -1};

int main() {
	///freeopen();
	ios_ssync;
	int n;
	cin >> n;
	string s;
	cin >> s;
	for (int i = 0; i < size(s) - 1; i++)
		if (s[i] == 'U' && s[i + 1] == 'R' || s[i] == 'R' && s[i + 1] == 'U') {
			s[i] = 'd';
			s[i + 1] = 'd';
		}
	int cnt = 0;
	int num = 0;
	for (int i = 0; i < size(s); i++) {
		if (s[i] == 'd')
			cnt++;
		else num++;
	}
	printf("%d", (cnt >> 1) + num);
	return 0;
}

#include<stdio.h>
#include<queue>
#include<vector>
#include<stack>
#include<algorithm>
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
	int m;

	scanf("%d",&m);
	string s;
	cin>>s;

	int ans=m;
	for(int i=1;i<m;i++)
		 {

		 	if(s[i-1]=='R'&&s[i]=='U')
		 		  {
                    s[i]='D';
		 		  	ans--;
		 		  }
		    else if(s[i-1]=='U'&&s[i]=='R')
		    	     {
		    	         s[i]='D';
                    ans--;
		    	     }

		 }
	 printf("%d\n",ans);
	 return 0;

}

#include<bits/stdc++.h>
using namespace std;
 int main()
{
	int n,i,c;
	string str;
	cin>>n;
	cin>>str;
	c=0;
	for(i=0;i<n;i++)
   {
	  if(str[i]!=str[i+1])
	{
		c=c+1;
		i=i+1;
	}
	   else
	{
		c=c+1;
	}

   }
   cout<<c;

}

#include <bits/stdc++.h>

using namespace std;
bool ss[105];
int main()
{
int n;string s;cin>>n>>s;int x=0;

for(int i=0;i<s.size()-1;i++)
{
if((s[i]=='R'&&s[i+1]=='U')||(s[i]=='U'&&s[i+1]=='R'))
if(ss[i]!=1){
        x++;
    ss[i+1]=1;}
}
 cout <<s.size()-x;
    return 0;
}

#include <iostream>
#include <string>
using namespace std;
int main() {
	int x;
	cin >> x;
	string y;
	cin >> y;
	int count = 0;
	for (int i = 0; i < y.length()+1; i++) {
		if ((y[i] == 'U'&&y[i + 1] == 'R') ||( y[i] == 'R'&&y[i + 1] == 'U')) {
			count++;
			i += 1;
		}
		/*else
		{
			count++;
		}*/

	}
	cout << y.length()-count << endl;

	return 0;
}

#include <bits/stdc++.h>
char str[100];
int flag[100];
int main()
{
	int n,i,ans=0;
	scanf("%d",&n);
	scanf("%s",str);
	for(i=1;i<n;i++)
	{
		if(flag[i-1]==0&&str[i]!=str[i-1])
		{
			ans++;
			flag[i]=1;
		}
	}
	ans=n-ans;
	printf("%d\n",ans);
	return 0;
}

#include<iostream>
using namespace std;
int n,l;
int main(){
	cin>>n;
	string a;
	cin>>a;
	l=a.size();
	for(int i=0;i<l-1;i++) {
		if((a[i]=='R'&&a[i+1]=='U')||(a[i]=='U'&&a[i+1]=='R')) {
			l--;
		//	a[i]='D',a[i+1]='D';
		}
	}
	cout<<l;
	return 0;
}

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

int main() {
	int n,i,ans=1;
	cin>>n;
	string s;
	cin>>s;
	for(i=0;i<n-1;){
		if(s[i]!=s[i+1]){
			ans++;
			i+=2;
		}
		else{
		ans++;
		i++;
		}
	}

	cout<<ans;
	// your code goes here
	return 0;
}

#include<iostream>
using namespace std;

int main()
{
    int n;
    char ch[105];
    int ans = 0;
    cin>>n>>ch;
    int i=0;
    while(i<n-1)
    {
        if(ch[i]=='R'&& ch[i+1]=='U')
        {
            ans++;
            i++;
        }
        if(ch[i]=='U' && ch[i+1]=='R')
        {
            ans++;
            i++;
        }
        i++;
    }
    cout<<n-ans<<endl;
}

#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    char a[110];
    int n,i,x,y;
    while(~scanf("%d",&n))
    {
        x=0;
        y=0;
        scanf("%s",a);
        for(i=0;i<n;i++)
        {
            if(a[i]=='U')
                x++;
            else
                y++;
        }
        x=min(x,y);
        if(x)
            printf("%d\n",x*2-1);
        else
            printf("0\n");
    }
}

#include <iostream>
using namespace std;
int main()
{
    int x;
    cin>>x;
    char a[x];
    for(int i=0;i<x;i++)
    {
     cin>>a[i];

    }
    int m=0;
    for(int i=0;i<x-1;i++)
    {
        if(a[i]!=a[i+1]&&a[i]==a[i+2])
        {
            m++;
            i=i+2;
        }
        if(a[i]!=a[i+1]&&a[i]!=a[i+2])
        {
            m++;
        }

    }
    cout<<x-m;
}

#include <iostream>
#include <string>

int main(){
    int n=0;
    std::string string;

    std::cin >> n;
    std::cin >> string;
    int result=n;

    for(int i=1; i < n; i++){
        int j = i;
        int x = j--;
        if ((string[j] == 'U' && string[x] == 'R')){
            result--;
            i++;
        } else if (string[j] == 'R' && string[x] == 'U'){
            result--;
        }
    }

    std::cout << result;
    return 0;
}

#include <iostream>
#include <cstring>

using namespace std;

int main()
{
    int n,ans;
    string str;
    cin>>n>>str;
    ans=n;
    for(int i=0;i<n-1;i++){
        if(str[i]!=str[i+1])ans--;
        i++;
    }
    cout<<ans<<endl;
    return 0;
}

#include <iostream>
#include <string>
#include <cstring>
#include <stdio.h>
using namespace std;
char a[1000];
int t,dp[100000];
int dfs(int i)
{
    if(dp[i]>0)
        return dp[i];
    int ans;
    if(i==t)
        ans=0;
    else if((a[i]=='R'&&a[i+1]=='U')||(a[i]=='U'&&a[i+1]=='R'))
        ans=min(dfs(i+1)+1,dfs(i+2)+1);
    else ans=dfs(i+1);
    return dp[i]=ans;
}
int main()
{
    scanf("%d",&t);
    for(int i=0;i<t;i++)
        scanf("%c",&a[i]);

    printf("%d",t-dfs(0));
	return 0;
}

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

int main(){
	string str; cin>>str;
	int R = 0,U = 0;
	for (int i=0; i<str.length(); i++){
	    //cout<<R<<" "<<U<<endl;
		if (str[i] == 'R'){
		    R = R+1;
		} else {
		    U = U+1;
		}
	}
	if (R > U){
	    cout<<R;
	} else {
	    cout<<U;
	}
}

#include<iostream>
#include<string>
using namespace std;
int main()
{
int n;
cin>>n;
string p;
cin>>p;
p[0];
for(int i=1;i<n;i++)
{
	if(p[i]!=p[i-1])
	   n--;

}
cout<<n;
return 0;
}

#include <bits/stdc++.h>
using namespace std;
int i,n,j,k;
string s;

int main () {
      cin>>n>>s;
      for(i=0;i<n;i++){
        if(s[i] == 'R' && s[i+1] == 'U') {s.erase(i,2); k++;}
        if(s[i] == 'U' && s[i+1] == 'R') {s.erase(i,2); k++;}

      } cout<<s.size() + k;
}

#include <iostream>
#include <string>
using namespace std;

int Handle()
{
	int n;
	int count = 0;
	string s;
	cin >> n;
	cin >> s;
	for (int i = 0; i <= n; i++)
	{

		if (s[i] == 'U' || s[i] == 'R')
		{
			count++;
			i++;

		}
		else if (s[i] == 'R' || s[i] == 'U')
		{
			count++;
			i++;

		}

	}
	return count;
}

int main()
{
	string s;
	int ans = Handle();
	cout << ans << endl;
//	system("pause");
	return 0;
}

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

int main() {
	int n;
	cin >> n;
	string hemal;
	cin >> hemal;
	int c=0;
	for(int i=0;i<(n-1);i++){
		if(hemal[i]=='U' && hemal[i+1]=='R'){
			c=c+1;
			i=i+2;
		}
		else if(hemal[i]=='R' && hemal[i+1]=='U'){
			c=c+1;
			i=i+2;
		}
	}
	int d;
	d=n-c;
	cout << d;

	// your code goes here
	return 0;
}

/*
 * socode.online
 *
 * Author: 小螺号
 * E-mail: 598601767@qq.com
 * Time  : 2020-04-18 19:59:36
 */
#include <bits/stdc++.h>
using namespace std;

char s[105];
int vis[105];

int main(){
    int n;
    scanf("%d",&n);
    scanf("%s",s);
    for(int i=1;i<n;i++){
        if(s[i]!=s[i-1]&&vis[i]==0&&vis[i-1]==0){
            vis[i]=1;
            vis[i-1]=1;
            n--;
        }
    }
    printf("%d\n",n);
    return 0;
}

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

int main() {
	int n;
	cin>>n;
	string s;
	cin >> s;
	int a=0,b=a;
	for (int i =0;i<n;i++){
		if (s[i]=='R')
			a++;
		else
			b++;
	}
	cout<<max(a,b);
	return 0;
}

#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int main()
{
  int n;
  char str[105];
  scanf("%d",&n);
  scanf("%s",str);
  for(int i=0;i<n-1;i++){
    if(str[i] + str[i+1] == 'U' + 'R'){
      n--;
    }
  }
  printf("%d\n",n);
  return 0;
}

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

int main() {
    int n;
    cin>>n;
	string x;
	cin>>x;
	int visited1[n]={0};
	int visited2[n]={0};
	int count1=0;
	int count2=0;
	for(int i=0;i<x.size();i++)
	{
	    if(x[i]=='U' && x[i+1] == 'R' &&  visited1[i]==0    &&  visited1[i+1]==0)
	    {
	        count1++;
	        visited1[i]=1;
	        visited1[i+1]=1;
	    }
	}

	for(int i=0;i<x.size();i++)
	{
	    if(x[i]=='R' && x[i+1] == 'U' &&  visited1[i]==0    &&  visited1[i+1]==0)
	    {
	        count1++;
	        visited1[i]=1;
	        visited1[i+1]=1;
	    }
	}

	for(int i=0;i<x.size();i++)
	{
	    if(x[i]=='R' && x[i+1] == 'U' &&  visited2[i]==0    &&  visited2[i+1]==0)
	    {
	        count2++;
	        visited2[i]=1;
	        visited2[i+1]=1;
	    }
	}

	for(int i=0;i<x.size();i++)
	{
	    if(x[i]=='U' && x[i+1] == 'R' &&  visited2[i]==0    &&  visited2[i+1]==0)
	    {
	        count2++;
	        visited2[i]=1;
	        visited2[i+1]=1;
	    }
	}

	int d=max(count1,count2);
	cout<<(n-d);
	return 0;
}

#include <iostream>

using namespace std;

int main()
{
int n;string s;cin>>n>>s;int x=0;
bool ss[n];
for(int i=0;i<n-1;i++)
{
if((s[i]=='R'&&s[i+1]=='U')||(s[i]=='U'&&s[i+1]=='R'))
if(ss[i]!=1){
        x++;
    ss[i+1]=1;}
}
 cout <<n-x;
    return 0;
}

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int n,ans = 0,i;
int find(char a[])
{
  for( i=  1;i<=n;i++)
  {
    if(a[i] == 'U'&&a[i+1] == 'R')
        {
          ans++;
          i++;
           }
    else if(a[i] == 'R'&&a[i+1] == 'U')
      {  ans++;
        i++;
  }
}
  return ans;
}
int main ()
{
  scanf("%d",&n);
  char a[101];
  for(int i = 1;i<=n;i++)
     scanf("%c",&a[i]);
  if((a[n] == 'U'&&a[n-1] == 'R'))
      printf("%d\n",n-find(a)-1);
  else printf("%d\n",n-find(a));
  return 0 ;
}

#include<iostream>
using namespace std;
int main()
{
	int n,i;
	cin>>n;
	char *arr=new char[n];
	for(i=0;i<n;i++)
	{
		cin>>arr[n];
	}
	i=0;
	int ans=n;
	while(i<n)
	{
		if(i==n-1)
		{
			break;
		}
		if(arr[i]==arr[i+1])
		{
			i=i+1;
			continue;
		}
		else
		{
			i=i+2;
			ans--;
			continue;
		}
	}
	cout<<ans;
	return 0;
}

#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main()
{
    int a,b;
    cin>>a;
    b=a;
    char p[a];
    for(int j=0;j<a;j++)
    {
        cin>>p[j];

    }
    for(int i=0;i<a;i++)
    {
        if((p[i]!=p[i+1]))
           {
               b--;i++;
           }

    }
    b++;
    cout<<b;
}

#include<algorithm>
#include<stack>
#include <iostream>
using namespace std;

int main()
{
	int n, count=0;
	char c,t1,t2;
	stack<char> str;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> c;
		str.push(c);
	}

	while (!str.empty())
	{
		t1 =str.top();
		str.pop();
		if (!str.empty()) {
			t2 = str.top();
			str.pop();
			if ((t1 == 'U' && t2 == 'R') || (t1 == 'R' && t2 == 'U'))
			{
				count++;
				//str.push(t2);
			}
		}
	}
	if (count >0)
	cout << n - count-1;
	else cout << n;

	return 0;
}

#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
#define dd c=getchar()
inline ll read(){
	ll x=0,f=1;char dd;
	for(;!isdigit(c);dd)if(c=='-')f=-1;
	for(;isdigit(c);dd)x=(x<<1)+(x<<3)+(c^48);
	return x*f;
}
#undef dd
string s;ll n,ans;
bool vis[500];
int main(){
	cin>>n;
	cin>>s;
	ans=n;
	for (ll i=0;i<n-1;i++) if (s[i]=='R'&&s[i+1]=='U') vis[i]=vis[i+1]=1,ans--;
	for (ll i=0;i<n-1;i++) if (s[i]=='U'&&s[i+1]=='R'&&!vis[i]&&!vis[i+1]) vis[i]=vis[i+1]=1,ans--;
	cout<<ans;
	return 0;
}

#include<iostream>
#include<cmath>
#include<string>
using namespace std;
void main()
{
	int		n	;
	cin	>>	n	;
	string name;
	cin>>name;
	for(int i = 0 ; i < n ;)
	{
		if(name[i]=='U' && name[i+1]=='R' )
		{
			n--;
			i+=2;
		}
		else if(name[i]=='R' && name[i+1]=='U')
		{
			n--;
			i+=2;
		}
		else
			i++;
	}//for
	cout<<n<<endl;

}

#include <iostream>

using namespace std;

int main(){
	int n;
	pair<char, char> seq;
	string result;
	cin >> n;
	cin >> seq.first;
	for (int i = 1; i < n; ++i) {
		cin >> seq.second;
		if (seq.first != seq.second) {
			result += 'D';
			if (i != n - 1) {
				cin >> seq.second;
				++i;
			}
		}
		else {
			result += seq.first;
		}
		seq.first = seq.second;
	}
	if (n % 2 != 0)
		result += seq.second;
	cout << result.length();
}

#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  int i,n,k=0;
  cin>>n>>s;
  for(i=1; i<n; i++)
    if(s[i]=='R'&&s[i-1]=='U'||s[i]=='U'&&s[i-1]=='R'){
      s[i]='D';
      k++;
   }
  cout<<s<<endl;
  cout<<n-k;
  return 0;
 }

#include <bits/stdc++.h>
#define ll long long
const ll inf=1e13+10;
const int MAXN=1e5+10;
using namespace std;
ll readll(){
    ll x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int readint(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
    return f*x;
}
int n;char d[105];
int main(){
    n=readint();
    for(int i=1;i<=n;i++) scanf(" %c",&d[i]);
    int cnt=0;int i=1;
    while(i<n){
        if(d[i]=='R'&&d[i+1]=='U'||d[i]=='U'&&d[i]=='R'){
            cnt++;i+=2;
        }
        else cnt++,i++;
    }
    cout<<cnt<<endl;
    return 0;
}

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main(){
	int a;
	char b[110];
	while(~scanf("%d",&a)){
		getchar();
		int ans = 0;
		gets(b);
		for(int i = 1;i < a;i++){
			if(b[i] != b[i - 1]){
				ans++;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

#include<iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long LL;
const int N=1e5+5;
void solve(){
    int n;
    cin>>n;
    string str;
    cin>>str;

    int cnt=0;
    for (int i=0;i<n;i++){
        cnt++;
        if (str[i]=='R' && i<n-1 && str[i+1]=='U') {
            i++;
        }
        if (str[i]=='U' && i<n-1 && str[i+1]=='R') {
            i++;
        }
    }
    cout<<cnt<<endl;
}
int main(){
    solve();
    return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main() {
    char s[10009];
    int n;
    cin>>n;
    getchar();
    gets(s);
    int l=strlen(s);
    for(int i=0; s[i]; i++) {
        if((s[i]=='U' && s[i+1]=='R')||(s[i]=='R' && s[i+1]=='U')) {
            i+=2;
            l--;
        }
    }
    cout<<l<<endl;
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

int main()
{
int n;string s;cin>>n>>s;int x=0;
bool ss[s.size()];
for(int i=0;i<s.size()-1;i++)
{
if((s[i]=='R'&&s[i+1]=='U')||(s[i]=='U'&&s[i+1]=='R'))
if(ss[i]!=1){
        x++;
    ss[i+1]=1;}
}
 cout <<s.size()-x;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
vector<char>v;
main(){
    int n;
    string s;
    cin>>n>>s;
    for(int i=0;i<s.size()-1;i++){
        if(s[i]=='U'&&s[i+1]=='R'){v.push_back('D');i++;}
        else if(s[i]=='R'&&s[i+1]=='U'){v.push_back('D');i++;}
        else v.push_back(s[i]);
    }
    cout<<v.size()+1;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,len=0;
    string s;
    cin>>n;
    cin>>s;
    for(int i=0;i<n-1;i++){
        if(s[i]==s[i+1]){
            ++len;
        }
        else{
            ++len;
            ++i;
        }
    }
    cout<<len+1;
    return 0;
}

#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <numeric>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, k, n) for(int i = (k); i < (int)(n); i++)
using namespace std;
using ll = long long;
int N;
string s;
int main(){
    cin >> N;
    cin >> s;
    int cnt = 0;
    FOR(i, 1 ,N){
        if((s[i] == 'U' && s[i - 1] == 'R') || (s[i] == 'R' && s[i - 1] == 'U')){
            cnt++;
            if(i != N - 2)
                i++;
            else{
                cnt++;
                break;
            }
        }
        else{
            cnt++;
            if(i == N - 1)
                cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

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

int main(){
    int n;
    cin>>n;
    string a;
    cin>>a;
    int len=n;
    for(int i=0;i<n-1;i++){
        if(a[i]==a[i+1]){
            len--;i++;
        }
    }
    cout<<len<<endl;
}

#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <stack>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <tuple>

using namespace std;
typedef long long ll;

#define endl "\n"
#define INF 200000000
#define MOD 1000000007
#define pii pair <int, int>

typedef long long ll;

int N, M, K, L, Q;

char A[101];

string PAT[4] = { "RU","UR","LU","UL" };

int main() {

	cin >> N;
	cin >> A;
	string S = "";
	for (int i = 0; i < N; i++) S.push_back(A[i]);
	int ret = 0;
	for (int k = 0; k < 300; k ++) {
		for (int i = 0; i < 4; i++) {
			int idx = S.find(PAT[i], 0);
			if (idx != string::npos) S[idx] = S[idx + 1] = 'X', ret++;
		}
	}
	cout << N - ret;
	cin >> N;
}

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int main()
{
    int n;
    scanf("%d", &n);
    char now='0',in;
    scanf("%c", &in);
    for(int i=0;i<n;i++)
    {
        scanf("%c", &in);
        if(now=='0') now=in;
        else if(in!=now)
        {
            now='0';
            n--;
        }

    }
    printf("%d", n);
}

#include <bits/stdc++.h>

#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define mp make_pair
#define input freopen("input.txt","r",stdin);
#define output freopen("output.txt","w",stdout);
#define fast_io ios::sync_with_stdio(NULL), cin.tie(NULL), cout.tie(NULL);
#define fix cout << fixed << setprecision(15);
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int> ;
using pll = pair<ll, ll>;
using pci = pair<char, int>;
using vi = vector<int> ;
using vll = vector<ll> ;
const ll infll = 1e18 + 3;
const int maxn = 1e6 + 77;
const ll basell = 1e18 + 3;
const int mod = 1e9 + 7;
const ld eps = 1e-7;
const int inf = 1009000999;
const int nv = 100100;
const int baseint = 1000200013;
const ld PI = acos(-1.0);
inline bool EQ(ld a, ld b) { return fabs(a-b) < 1e-9; }
//ifstream cin("input.txt");
//ofstream cout("output.txt");
//cout << fixed << setprecision(15);
/*
for(int c : s)
for (int &i : a) cin >> i;
for(int c = 'a'; c <= 'z'; ++c)
vector<vector<ll>> dp(n, vector<ll>(n+2));     // 10 10 10 20 20 20 30 30
low = std::lower_bound (v.begin(), v.end(), 20); //          ^
up = std::upper_bound (v.begin(), v.end(), 20); //                   ^
char 0 = int 48;
char c = cin;
int h = (int)c - 48;
*/

int solve() {
    //input;//,output;
    //fix;
    fast_io;
    int n;
    cin >> n;
    string s, s1;
    cin >> s;
    int u = 0;
    for (int i = 0; i < n; ++i) {
        if(i > 0){
            if((s[i - 1] == 'U' && s[i] == 'R')||(s[i - 1] == 'R' && s[i] == 'U')){
                u = 1;
            }
        }
        if(i < n - 1){
            if((s[i + 1] == 'U' && s[i] == 'R')||(s[i + 1] == 'R' && s[i] == 'U')){
                u = 2;
            }
        }
        if(u != 0){
            if(u == 2) i++;
            u = 0;
            s1 +='D';
        }else{
            if(i > 0) s1 +=s[i - 1];
        }
    }
    if(s1[s1.length() - 1] != 'D') s1 += s[n - 1];
    cout << s1.length() << '\n';
    //cout << s1;
}

int32_t main() {
    solve();
    return 0;
}

/*
100000000 1000000000

3 2
1 2 1
2 3 2
3 2
1 2 1
2 3 2
 * */

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

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n,c=0;
    cin>>n;
    string a;
    cin>>a;
    int i;
    for(i=0;i<a.length()-1;i++)
    {
        if(a[i]=='R'&&a[i+1]=='U')
        {

            i++;
            c++;
            if(i==a.length()-2)
            {
                c++;
            }
        }
        else if(a[i]=='U'&&a[i+1]=='R')
        {
            i++;
            c++;
             if(i==a.length()-2)
            {
                c++;
            }
        }
        else
        {
            c++;
            if(i==a.length()-2)
            {
                c++;
            }

        }
    }
    cout<<c<<endl;

}

/*
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 * 							vk.com/i_hate_acm
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 * */

#include <bits/stdc++.h>

using namespace std;

const int INF = int(1e9);
const int INF64 = int(1e18);

#define forn(i, n) for(int i = 0; i < int(n); i++)
#define endl "\n"
#define mp make_pair
#define pb push_back

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const int MOD = int(1e9 + 7);
void add(int &a, int b) {
	a += b;
	if(a >= MOD) {
		a -= MOD;
	}
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i = 0; i < int(s.size() - 1); i++) {
		if(s[i] == 'U' && s[i + 1] == 'R') {
			s[i] = 'D';
			s[i + 1] = '*';
		}
		if(s[i] == 'R' && s[i + 1] == 'U') {
			s[i] = 'D';
			s[i + 1] = '*';
		}
	}
	int cnt = 0;
	int oth = 0;
	for(int i = 0; i < int(s.size() - 1); i++) {
		if(s[i] == 'D') {
			cnt += 1;
		} else {
			oth += 1;
		}
	}
	cout << cnt + oth - 1;
	return 0;
}

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

    int main()
    {
        int n,cnt=0;
        string s,s1,s2,temp;
        cin>>n>>s;
        s1="RU";
        s2="UR";
        int i=0;
        while(i<n-1){
            temp=s.substr(i,2);
            if(temp==s1 || temp==s2)++cnt;
            i+=2;
        }
        cout<<n-cnt;
        return 0;
    }

#include <stdio.h>
#include <string.h>
int main(){
	char s[101];
	int n,m=0;
	scanf("%d",&n);
	for(int i=0;i<=n;i++) scanf("%c",&s[i]);
	for(int i=0;i<=n;i++)
        if(s[i]!=s[i+1]) {
			m++;i++;
		}
	printf("%d",m);
}

#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define lld long double
#define w(x) ll x;cin>>x;while(x--)
#define mod 1000000007
#define speed ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;

ll fpm(ll x,ll y,ll m){
    ll res=1;
    while(y>0){
        if(y&1){
            res=(res*x)%m;
        }
        y=y>>1;
        x=(x*x)%m;
    }
    return (res%m);
}

int main(){
    speed;
    ll n;   cin>>n;
    string s;   cin>>s;
    string t;
    for(ll i=0;i<n-1;){
        if((s[i]=='R'&&s[i]=='U')||(s[i]=='U'&&s[i+1]=='R')){
            t.push_back('D');
            i+=2;
        }
        else{
            t.push_back(s[i]);
            i++;
        }
    }
    cout<<t.length()<<'\n';
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
char s[105];
int main(){
    int n;
    scanf("%d%s",&n,s);
    int ans=1,flag=0;
    for(int i=1;i<n;i++){
        if(flag){
            flag=0;
            continue;
        }
        if(s[i]!=s[i-1])flag=1;
        ans++;
    }
    cout<<ans;
    return 0;
}

#include <iostream>
#include <string>

using namespace std;

int main(){
	string input;
	cin >> input;

	string newString = "";

	for(int i = 0; i < input.length() - 1; i++){
		if(input[i] == input[i+1]){
			newString.append(input, i, 1);
		}
		else{
			newString.append("D");
			i++;
		}
	}

	cout << newString.length() << endl;
}

#include<iostream>
using namespace std;
#include<string>
int main(){
	int x,total=0;
	string arr;
	char pre;
	cin >> x;
	cin >> arr;
	bool s = false;
	for (int i = 0; i < x; i++){
		if (i == 1)total++;
		if (s){
			s = false;
			total++;
			pre = arr[i];
			continue;
		}
		if (i>0)
		{
			if (arr[i] != pre){
				s = true;
			}
			else{
				if (i == 1)
					total++;
				else total++;
			}
		}
		pre = arr[i];
	}
	cout << total << endl;
}

#include <bits/stdc++.h>
using namespace std;
int main(int argc,char const *Argv[])
{
	int n;
	cin>>n;
	cin.ignore();
	string s;
	getline(cin,s);
	int ans = 0;
	int i = 0;
	for(;i < s.size() - 1; ++i)
	{
		if(s[i] == 'U' && s[i + 1] == 'R')
		{
			ans++;
			i++;
		}
		else if(s[i] == 'R' && s[i + 1] == 'U')
		{
			ans++;
			++i;
		}
		else
		{
			ans++;
		}
		if(i == s.size() - 2)
		{
			ans++;
		}
	}
	if(i != s.size() - 1)
	{
		ans++;
	}
	printf("%d\n",ans);
	return 0;
 }

/*
 * socode.online
 *
 * Author: 小螺号
 * E-mail: 598601767@qq.com
 * Time  : 2020-04-18 19:59:36
 */
#include <bits/stdc++.h>
using namespace std;

char s[105];
int vis[105];

int main(){
    int n;
    scanf("%d",&n);
    scanf("%s",s);
    for(int i=1;i<n;i++){
        if(s[i]!=s[i-1]){
            n--;
        }
    }
    printf("%d\n",n);
    return 0;
}

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

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int &v:a)cin>>v;
    int len=n;
    for(int i=0;i<n-1;i++){
        if(a[i]!=a[i+1]){
            len--;i++;
        }
    }
    cout<<len<<endl;
}

/*#include<iostream>
#include<algorithm>
#include<string>*/
#include<bits/stdc++.h>
using namespace std;
#define f(i,low,up) for(int i=low;i<up;i++)
#define f1(i,low,up) for(int i=low;i<=up;i++)
#define f2(i,up,low) for(int i=up;i>=low;i--)
#define ll long long
#define m(v,i) memset(v,i,sizeof(v))
#define sc(t)  scanf("%d",&t)
#define MOD 1000000007
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}

//#include "unordered_map"//doesn't compile in dev c++
int main(){

  int n;
  string s;
  cin>>n>>s;
  int cnt=n;
  char prev='x';
  f(i,0,s.length()-1){
  	if(prev=='x')
  	prev=s[i];
  	else{
  		  if(s[i]!=prev)
  		  {
  		     cnt--;
			 prev='x';
		  }
	  }
  }

  cout<<cnt<<"\n";

	return 0;
}

#include<cstdio>
#define Rint register int
using namespace std;
int n;
char a[101];
int main(){
	scanf("%d\n%s", &n, a);
	for(Rint i = 0;i < n - 1;i ++)
		if(a[i] != a[i + 1]) {n --;i ++;}
	printf("%d", n);
}

	#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define fori(a,b) for(int i=a;i<=b;i++)
	#define ford(a,b) for(int i=a;i>=b;i--)
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	using namespace std;

	int main()
	{
		string str;
		cin>>str;
		string sout;
		int i=0,j=0;
		int l=str.length()-1;
		while(i<=l && l!=0)
		{
			if((str[i]=='U' && str[i+1]=='R') || (str[i]=='R' && str[i+1]=='U'))
			{

				j++;
				i++;
			}
			else
			{
				j++;
			}
			i++;

		}
		if(l!=0)
			cout << j << endl;
		else
			cout << 1 << endl;
		return 0;
	}

#include <bits/stdc++.h>
using namespace std;
int i,n,j,k;
string s;

int main () {
      cin>>n>>s;
      for(i=0;i<n;i++){
        if(s[i] == 'R' && s[i+1] == 'U') {s.erase(i,2); k++;}
        if(s[i] == 'U' && s[i+1] == 'R') {s.erase(i,2); k++;}

      } cout<<s.size() + k;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int d=n;
	string s;
	cin>>s;
	for (int k=0; k<n-1; k++){
		if (s[k]=='R' and s[k+1]=='U'){
			d--;
			k++;
			s[k]='D';
			s[k+1]='D';
		}
		if (s[k]=='U' and s[k+1]=='R'){
			d--;
			k++;
			s[k]='D';
			s[k+1]='D';
		}
	}
	cout<<d;

}

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int d=n;
	string s;
	cin>>s;
	for (int k=0; k<n; k++){
		if (s[k]=='R' and s[k+1]=='U'){
			d--;
			k++;
		}
		if (s[k]=='U' and s[k+1]=='R'){
			d--;
			k++;
		}
	}
	cout<<d;
}

#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<vector>
#include<conio.h>
using namespace std;

int main()
{

int n, z = 0;
string s;
cin >> n >> s;
for (int i = 0; i <n; i++)
{
if (s[i] == 'R'&&s[i + 1] == 'U' || s[i] == 'U'&&s[i + 1] == 'R')
{
z++;

}
}
cout <<z<<endl;
return 0;
}

#include <iostream>
#include<algorithm>
#include<string>
#include<map>
#include <iterator>
#include<iomanip>
#include<vector>
#include<cmath>
#include <cstdio>
#include<queue>
#include<stack>
#include<list>
#include<stdio.h>
#include<set>
#include <functional>

#define mod 1000000007
#define mod2 30000000
#define pa(a,b) make_pair(a,b)
#define f first
#define s second
#define pb(a)  push_back(a)
#define all(a) a.begin() , a.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define LL  long long int
#define oo 2e9
#define pi 3.14159265359
#define eps  1e-9

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

LL maxx(LL a , LL b){ return a>b ?  a : b ;}
LL minn(LL a , LL b){ return a>b ?  b : a ;}

using namespace std;
int dx[] = {1 , 1 ,1 , 0 , 0  , -1 , -1  , -1  , 0 };
int dy[] = { -1 , 0  , 1 , 1 , -1 , 0 , 1 , -1 , 0 };
void boostIO()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
LL gcd(LL a, LL b) {
    return b == 0 ? a : gcd(b, a % b);
}
LL lcm(LL a , LL b )
{
    return (a*b)/gcd(a , b);
}
LL poww(LL base, LL exp){
  base %= mod;
  LL result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % mod;
    base = (base * base) % mod;
    exp >>= 1;
  }
  return result;
}
int main()
{
    int n ; cin >> n;
    string s; cin >> s ;
    while(1){
        string ans = "" ;
        for(int i = 0 ; i < s.size() - 1 ; i++){
            if(s[i] == 'U' && s[i + 1] == 'R'){
                ans = ans + "D" ;
                i++ ;
                continue;
            }
            else if(s[i] == 'R' && s[i + 1] == 'U'){
                ans = ans + "D" ;
                i++ ;
                continue;
            }
            else
                ans = ans + s[i] ;
        }
        if(s.size() % 2 == 1)
            ans = ans + s.back() ;
        if(ans.size() == s.size())
            break;
        swap(ans , s) ;
    }
    cout << s.size() << endl ;
}

#include <regex>
#include <string>
#include <cstdlib>
#include <iostream>
using std::regex_replace;
using std::regex;
using namespace std;
int main( const int, const char** ){
int n;
string a;
cin>>n;
cin>>a;
int countRU=0;
int countUR=0;
for(int i = 0 ; i < n ; i++){
        if(a[i]=='R'&&a[i+1]=='U')
        {
            countRU++;
            i++;
        }
}
for(int i = 0 ; i < n ; i++){
        if(a[i]=='U'&&a[i+1]=='R')
        {
            countUR++;
            i++;
        }
}
if(countRU>countUR){
for(int i = 0 ; i < n ; i++){
        if(a[i]=='R'&&a[i+1]=='U')
        {
            a[i]='*';
            a[i+1]='*';
            i++;
        }
}
countUR=0;
for(int i = 0 ; i < n ; i++){
        if(a[i]=='U'&&a[i+1]=='R')
        {
            countUR++;
            i++;
        }
}
cout<<n-(countRU+countUR);
}
else{
for(int i = 0 ; i < n ; i++){
        if(a[i]=='U'&&a[i+1]=='R')
        {
            a[i]='*';
            a[i+1]='*';
            i++;
        }
}
countRU=0;
for(int i = 0 ; i < n ; i++){
        if(a[i]=='R'&&a[i+1]=='U')
        {
            countRU++;
            i++;
        }
}
cout<<n-(countRU+countUR);
}
   return EXIT_SUCCESS;
}

#include <iostream>
#include <string>
#include <map>
using namespace std;
map<string,int> mymap;
int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a>b?b:a;}
int main()
{
    //freopen("in.txt","r",stdin);
    string s;
    int i,j,n;
    while(cin>>n)
    {
		cin>>s;
        mymap.clear();
        for( i = 0 ; i < s.size() ; i++)
        {
           // for( j = 1 ; j <= s.size()-(i+1) ; j++)
            for( j = i+1 ; j < s.size() ; j++)
            {
                int len = j-i;
                string g = s.substr(i,len);
                mymap[g]=1;
            }
        }
        string kk;
        int ansmin=s.size();
        map<string,int>::iterator it;
        for(it=mymap.begin();it!=mymap.end();it++)
        {
            string tmp = (*it).first;
            int len = tmp.size();
            int cnt;
             cnt=0;
            for( i = 0 ; i <= s.size()-len ;)
            {
                if(s.substr(i,len)==tmp)
                {
                    cnt++;
                    i+=len;
                }
                else
                    i++;
            }
            ansmin=min(s.size()-cnt*len+cnt+len,ansmin);
        }
    //  cout<<kk<<endl;
        cout<<ansmin<<endl;
    }
    return 0;
}

#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
string s;ll n,ans;
bool vis[500];
int main(){
	cin>>n>>s;
	ans=n;
	for (ll i=0;i<n;i++) if (s[i]=='R'&&s[i+1]=='U'&&!vis[i]&&!vis[i+1]) vis[i]=vis[i+1]=1,ans--;
	for (ll i=0;i<n;i++) if (s[i]=='U'&&s[i+1]=='R'&&!vis[i]&&!vis[i+1]) vis[i]=vis[i+1]=1,ans--;
	cout<<ans;
	return 0;
}/****/

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

ll n,a[1000005];
string s;
int main(){
	ll i,j,k,nb,x,y;
	cin>>n;
	nb=n;
	cin>>s;
	for(i=0;i<n-1;i++){
		if(s[i]=='U'&&s[i+1]=='R'){
			nb=nb-2+1;
			i++;
		}
		if(s[i]=='R'&&s[i+1]=='U'){
			nb=nb-2+1;
			i++;
		}
	}
	if(n%2!=0)cout<<nb+1;

}

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<memory.h>
#include<string.h>
#include<math.h>
using namespace std;
typedef long long ll;
int n;
char m[105];
int dp[105][2];
int main(){
	scanf("%d",&n);
	fflush(stdin);
	scanf("%s",&m);
	dp[0][0]=1;
	dp[0][1]=1;
	for(int i=1;i<n;i++){
		if(m[i]!=m[i-1]){
			dp[i][1]=dp[i-1][0];
			dp[i][0]=min(dp[i-1][0]+1,dp[i-1][1]+1);
		}
		else{
			dp[i][1]=dp[i][0]=min(dp[i-1][0]+1,dp[i-1][1]+1);
		}
	}
	printf("%d\n",min(dp[n-1][0],dp[n-1][1]));
	return 0;
}

/*
 * socode.online
 *
 * Author: 小螺号
 * E-mail: 598601767@qq.com
 * Time  : 2020-04-18 19:59:36
 */
#include <bits/stdc++.h>
using namespace std;

char s[105];
int vis[105];

int main(){
    int n;
    scanf("%d",&n);
    scanf("%s",s);
    for(int i=1;i<=n;i++){
        if(s[i]==s[i-1]){
            continue;
        }
        else{
            if(vis[i]==0&&vis[i-1]==0){
                vis[i]==1;
                vis[i-1]==1;
                n--;
            }
        }
    }
    printf("%d\n",n);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin>>n;
	string st;
	cin>>st;
	for (int j=0; j<n-1; j++)
		if ((st[j]=='R'&&st[j+1]=='U')||(st[j]=='U'&&st[j+1]=='R')) {
			n--;
			j++;
		}
	cout<<n;
	return 0;
}

//q4s7mmmm
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define f first
#define se second
using namespace std;
ll n, m, cnt, ans, sum, res = -1e5;
char a[505][505];
vector <int> v;
vector <char> y;
set <int> x;
set <string> :: iterator it;
string s;
int main() {
	cin >> n;
	cin >> s;
	for (int i = 0; i < n - 1; i++) {
		if ((s[i] == 'U' && s[i + 1] == 'R') || (s[i] == 'R' && s[i + 1] == 'U'))
			x.insert(i), x.insert(i + 1);
	}
	cout << (n - x.size()) + (x.size() + 1) / 2;
    return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
bool flag[101];char a[101];int n;
int main(){
	cin>>n;memset(flag,true,sizeof flag);
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=2;i<=n;i++)if(a[i]!=a[i-1]&&flag[i]&&flag[i-1]){n-=1;flag[i]=flag[i-1]=false;}
	cout<<n;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n, r = 0, u = 0;
	string s;
	cin >> n >> s;
	for(int i = 0 ; i < n  ;i++)
	{
		if(s[i] == 'R')
			r++;
		else
			u++;
	}
	cout << max(u , r);
}

#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	int n;
	char str;
	int temp[110];
	scanf("%d", &n);
		memset(temp, 0, sizeof(temp));
		for (int i = 0; i < n; i++)
		{
			scanf("%c",&str);
			if (str == 'R')
				temp[i] = 0;
			else
				temp[i] = 1;
	    }
		int k = 0;
		for (int i = 0; i < n - 1; i++)
		{
			if (temp[i] != temp[i + 1])
			{
				++k;
				++i;
			}
			else
			{
				++k;
				if (i == n - 2)
				{
					++k;
				}
			}
		}
		printf("%d\n", k);
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 1e9;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i = 0; i < n-1; i++){
        if(s[i] != s[i+1]){
            n--;
            i++;
        }
    }
    cout << n;

    return 0;
}

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

int main(){
	string str; cin>>str;
	int R,U = 0;
	for (int i=0; i<str.length(); i++){
		str[i] == 'R' ? R++ : U++;
	}
	cout<<max(R,U);
}

#include<bits\stdc++.h>
using namespace std;
int main()
{
    long long int len,cnt=0,i;
    while(cin>>len){
    char s[len],nu[len];
    for(i=0;i<len;i++)
    {
        cin>>s[i];
    }
    s[i]='\0';
    for(i=0;i<len;)
    {
        if((s[i]=='R'&&s[i+1]=='U'))
        {
            nu[cnt]='D';
            cnt++;
            i=i+2;
        }
        else
        {
            nu[cnt]=s[i];
            cnt++;
            i++;
        }
    }
    cout<<strlen(nu)<<endl;
    }
}

#include<bits\stdc++.h>
using namespace std;
int main()
{
	int n; cin >> n;
	string s; cin >> s;
	int ed = string::npos;
	int pos = -1;
	int pos2 = -1;
	while ((pos2 = s.find("UR", pos2 + 1)) != ed)
	{
		s.erase(s.begin() + pos2, s.begin() + 2 + pos2);
		s.insert(pos2, "D");
	}
	while ((pos=s.find("RU", pos+1))!=ed)
	{
		s.erase(s.begin() + pos,s.begin()+2+pos);
		s.insert(pos,"D");
	}

	cout << s.length();
}

	#include <bits/stdc++.h>
	#include <cstdio>
	#include <cstring>
	#include <cmath>
	#include <cstring>
	#include <chrono>
	#include <complex>
	#define endl "\n"
	#define ll long long int
	#define fori(a,b) for(int i=a;i<=b;i++)
	#define ford(a,b) for(int i=a;i>=b;i--)
	#define vi vector<int>
	#define vll vector<ll>
	#define vvi vector < vi >
	#define pii pair<int,int>
	#define pll pair<long long, long long>
	#define mod 1000000007
	#define inf 1000000000000000001;
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y)
	#define mem(a,val) memset(a,val,sizeof(a))
	#define eb emplace_back
	#define f first
	#define s second
	using namespace std;

	int main()
	{
		string str;
		cin>>str;
		string sout;
		int i=0,j=0;
		int l=str.length()-1;
		while(i<=l && i!=0)
		{
			if((str[i]=='U' && str[i+1]=='R') || (str[i]=='R' && str[i+1]=='U'))
			{

				j++;
				i++;
			}
			else
			{
				j++;
			}
			i++;

		}
		if(l!=0)
			cout << j << endl;
		else
			cout << 1 << endl;
		return 0;
	}

#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
typedef long double ld;

int main(){
	string s;
	int n;
	cin >> n >>  s;

	char prev = s[0];
	char cur = ' ';
	int res = 0;
	for(int i = 1; i < s.size(); ++i){
		cur = s[i];
		if(s[i] != s[i-1]){
			res++;
			i+=2;
		}
	}

	cout << s.size()-res;

	return 0;
}

#include <bits/stdc++.h>
#define lld long long int
#define pb push_back
#define pp pop_back
using namespace std;
int main(){
	int a,u=0,r=0,ans=0;
	string m;
	cin>>a>>m;
	vector<int>g,h;
	r=a;
	for(int i=0;i<a-1;i++){

	if(m[i]=='U'&&m[i+1]=='R'&&m[i+2]=='U'){
		u++;
	}
	if(m[i]=='R'&&m[i+1]=='U'&&m[i+2]=='R'){
		u++;
	}

	}

	cout<<a-u-1;
	/*for(int i=0;i<min(h.size(),g.size())-1;i++){
		ans+=max(g[i],h[i])-abs(g[i]-h[i]);
	}
	//cout<<ans<<endl;
	cout<<a-ans;*/
	return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main(){
    int n;
    scanf("%d",&n);
    char s[n+2];
    int ans = 0;
    for(int i=0;i<n;i++){
        scanf("%c",&s[i]);
        if(i!=0 && s[i]!=s[i-1]){
            s[i]='D';
            ans++;
        }
    }
    cout<<n - ans<<endl;
    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(){
    int l;int out =0;
    cin >>l;
    string s;
    cin >>s;
    // getline (cin, s);
    for( int i=0;i < s.size()-1; i++){
        if( s[i]!= s[i+1]){
            out++;
            i++;
        }
        else
            out ++;;

    }

    if( s.size() %2 ==0)
       cout << out;
     else
        cout << out+1;

}

#include<iostream>
#include<string.h>
using namespace std;
int main(){
	string str;
	int len,i,j;
	cin>>len;
	cin>>str;
	//len=str.size();
	for(i=0;i<len;i++){
		//cout<<"i"<<i<<"\n";
		/*if(i==len-1){
			break;
		}*/
		if(str[i]=='R' && str[i+1]=='U'){
			len--;
			i++;
			//cout<<"vrtr";
		}
		else if(str[i]=='U' && str[i+1]=='R'){
			len--;
			i++;
		}
	}
	cout<<len;
	return 0;
}

#include<iostream>
#include<string>
using namespace std;
int main(){
    string a;
    cin>>a;
    int i=a.length();
    int w=0;
    while (w<i){
        if (a[w]=='R'&&a[w+1]=='U'||a[w]=='U'&&a[w+1]=='R'){
            a[w]='D';
            for (int t=w+1;t<i;t++){
                a[t]=a[t+1];
            }
        }
        w++;
    }
    int q=0;
    int c=0;
    int v=0;
    for (int u=0;u<i;u++){
        if (a[u]=='D'){q++;}
                if (a[u]=='R'){c++;}
        if (a[u]=='U'){v++;}

    }
    cout<<q+c+v;
}

#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
int n;
char s[maxn],vis[maxn];
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>s[i];
	}
	int ans=n;
	for(int i=1;i<n;i++){
		if(s[i]!=s[i-1]&&vis[i-1]==0){
			ans--;
			i++;
			vis[i]=1;
		}
	}
	cout<<ans;
	return 0;
}

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

int n;
char str[105];

inline void init() {
	scanf("%d", &n);
	scanf("%s", str);
}

inline void solve() {
	for (int i = 0; i < n - 1; i++) {
		if (str[i] != str[i + 1])
			i++, n--;
	}
	printf("%d", n);
}

int main() {
	init();
	solve();
	return 0;
}

#include <iostream>
using namespace std;
int main()
{
    int x;
    cin>>x;
    char a[x];
    for(int i=0;i<x;i++)
    {
        cin>>a[i];

    }
    int m=0;
    int t=0;
    for(int i=0;i<x-1;i++)
    {
        if(a[i]!=a[i+1]&&a[i]==a[i+2])
        {
            m++;
            t++;
        }
        if(a[i]!=a[i+1]&&a[i]!=a[i+2])
        {
            m++;

        }

    }
    cout<<x-m+t;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  string a;
  cin>>a;
  int count=0;
  for(int i=0;i<n;i++){
    if(a[i]=='U' && a[i+1]=='R'){
      count++;
    }
    else if(a[i]=='R' && a[i+1]=='U'){
      count++;
    }
  }
  cout<<(n-count);
  return 0;
}

#include <stdio.h>
#include <string.h>
int main(){
	char s[101];
	int n,m=0;
	scanf("%d",&n);
	for(int i=0;i<=n;i++) scanf("%c",&s[i]);
	for(int i=0;i<=n;i++)
        if(s[i]!=s[i+1]) {
			m++;i++;
		}
	printf("%d",m);
}

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

 int main (){
     int n;
     cin >>n;
     char t[n+1];
     for  (int i=0;i<n;i++){
        cin >>t[i];
     }
for (int i=0;i<n-1;i++){
    if ((t[i]=='U' && t[i+1]=='R')|| (t[i]=='R' && t[i+1]=='U')){n--;i=i+1;}
}

cout << n;

 return 0;}

#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <random>
#include <bitset>
#include <time.h>
#include <string>
#include <chrono>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
#define itn int
//#define endl '\n'
#define mp make_pair
#define pbc push_back
#define pob pop_back()
#define empb emplace_back
#define sp system("pause")
#define queuel queue<long long>
#define matrix vector<vector<ll>>
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pin(p) cin >> p.first >> p.second;
#define rev(v) reverse(v.begin(),v.end());
#define mx(v) max_element(v.begin(), v.end());
#define mn(v) min_element(v.begin(), v.end());
#define dig(c) (c >=' 0' && c <= '9') ? 1 : 0
#define sout(s, c) for(auto i : s) cout << i << c;
#define pout(p) cout << p.first << " " << p.second;
#define er(v, l, r) erase(v.begin() + l, v.begin() + r);
#define vin(v) for(ll i = 0; i < v.size(); i++) cin >> v[i];
#define vout(v, c) for(int i = 0; i < v.size(); i++) cout << v[i] << c;
#define pushi(v, a) for(int i = 0; i < a.size(); i++) v.push_back(a[i]);
#define sin(s, n) for(int i = 0; i < n; i++){int a; cin >> a; s.insert(a);}
#define fastio() ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
using namespace std;
/*▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ЗАПУСКАЕМ▒▀██████▄
░███▀▒▒▒▒▒ДЯДЮ▒▒▒▒▒▒▀█████
░▐██▒▒▒▒▒▒БОГДАНА▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄██████████████▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐*/
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
const ll INF = 1000LL * 1000 * 1000 * 1000 * 1000 * 1000;
const int inf = 1000000000 + 228;
const ld PI = acos(-1.0);
const ll mod1 = inf * inf + 1337 * 42 + 57 * 179 + 228;
const ll kekmod = 1000000000 + 7;
const ll mod2 = inf + 9;
const ll bigmod = 1LL * inf * 100 + 3;
const int MAXN = 5005;
const ld EPS = 1e-10;
const int N = 300228;
ll hp = 1e6 + 3;
signed main()
{
	fastio();
	string s;
	cin >> s;
	int ans = s.size();
	for (int i = 1; i < s.size(); ++i)
	{
		if (s[i] != s[i - 1])
		{
			--ans;
		}
	}
	cout << ans + 1;
}