//ReSharper disable All
using System;

namespace ConsoleApp1
{
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;

    public class Program
    {
        public static void Main(string[] args)
        {

            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            string s1 = s;
            int res = 0;

            //for (int i = 1; i < s1.Length; i++)
            //{
            //    if ((s1[i - 1] == 'U' && s1[i] == 'R') || (s1[i] == 'U' && s1[i-1] == 'R'))
            //    {

            //    }
            //}

            int i = 1;
            while (i < s1.Length || res != 0)
            {

                if ((s1[i - 1] == 'U' && s1[i] == 'R') || (s1[i] == 'U' && s1[i - 1] == 'R'))
                {
                    s1 = s1.Remove(i - 1, 2).Insert(i - 1, "D");
                    i++;
                }
                else
                {
                    i++;
                }
            }

            Console.WriteLine(s1.Length);

        }
    }

}

using System;

namespace problems
{
    class Program
    {
        static void Main(string[] args)
        {
            //RUURU
            int q = int.Parse(Console.ReadLine());
            String g = Console.ReadLine();;
            int n = 0;
            char[] x = g.ToCharArray();
            for (int i = 0; i < q; i++)
            {
                if(i == q-1)
                {
                    n++;
                }
                else if(x[i] == 'R' && x[i+1] == 'U')
                {
                    n++;
                    i++;
                }
                else if(x[i] == 'U' && x[i+1] == 'R')
                {
                    n++;
                    i++;
                }
                else
                {
                    n++;
                }
            }
            Console.WriteLine(n);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;

namespace CodeforcesTemplateClean
{

    class Program
    {

        static void Main(string[] args)
        {

            int n = int.Parse(Console.ReadLine());

            char[] a = Console.ReadLine().ToCharArray();

            int res = 0;

            for (int i = 0; i < n; i++)
            {
                if (i == n - 1)
                {
                    res++;
                }
                else
                {

                    if (((a[i] == 'R') && (a[i + 1] == 'U')) || ((a[i] == 'U') && (a[i + 1] == 'R')))
                    {
                        res++;
                        i++;
                    }
                    else
                    {
                        res++;
                    }
                }
            }

            Console.WriteLine(res);

        }

    }

}

using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int count = int.Parse(Console.ReadLine());
            string str = Console.ReadLine();
            for (int i = count - 1; i > 0; i--)
            {
                if (str[i] == 'R' && str[i - 1] == 'U' || str[i] == 'U' && str[i - 1] == 'R')
                    str = str.Remove(--i, 2).Insert(i,"D");
            }
            Console.WriteLine(str.Length);
        }
    }
}

using System;

namespace CSharpEdu
{
    class TestCS
    {
        static void swap(ref int a, ref int b)
        {
            int tmp = a;
            a = b;
            b = tmp;
        }
        static int LowerBound(int[] a, int lo, int hi, int x)
        {
            int mid;
            while (hi - lo > 1)
            {
                mid = (hi + lo) / 2;
                if (a[mid] < x)
                    lo = mid;
                else
                    hi = mid;
            }
            return hi;
        }
        static int UpperBound(int[] a, int lo, int hi, int x)
        {
            int mid;
            while (hi - lo > 1)
            {
                mid = (hi + lo) / 2;
                if (a[mid] <= x)
                    lo = mid;
                else
                    hi = mid;
            }
            return hi;
        }
        static void QuickSort(ref int[] a, int lo, int hi)
        {
            int key = a[(lo + hi) / 2];
            int i = lo, j = hi;
            while (i <= j)
            {
                while (a[i] < key) ++i;
                while (a[j] > key) --j;
                if (i <= j)
                {
                    if (i < j)
                        swap(ref a[i], ref a[j]);
                    ++i;
                    --j;
                }
            }
            if (lo < j) QuickSort(ref a, lo, j);
            if (i < hi) QuickSort(ref a, i, hi);
        }
        static int log2(int x)
        {
            int Res = -1;
            while (x != 0)
            {
                ++Res;
                x = x >> 1;
            }
            return Res;
        }
        static void Main()
        {
            string s;
            int Len = int.Parse(Console.ReadLine());
            s = Console.ReadLine();
            int res = Len, i;
            for (i = 0; i < Len - 1; ++i)
                if ((s[i] == 'U' && s[i + 1] == 'R') || (s[i] == 'R' && s[i + 1] == 'U'))
                {
                    --res;
                    ++i;
                }
            Console.Write(res);
            //Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Task_1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s;
            int N;
            int k = 0;
            N = Console.Read();
            Console.ReadLine();
            s = Console.ReadLine();
            int i;
            for (i = 1; i < s.Length; i++)
            {
                if (s[i] != s[i - 1] )
                {
                    i++;
                    k++;
                }
                else k++;

            }
            if (i == s.Length)
            {
                k++;
            }
            Console.Write(k);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string numberInput = "";
            string movements = "";
            int number = 0;
            numberInput = Console.ReadLine();
            movements = Console.ReadLine();
            int.TryParse(numberInput, out number);
            Regex regex = new Regex(@"((?:UR|RU))");
            MatchCollection matches = regex.Matches(movements);
            //movements = movements.Replace("UR", "D").Replace("RU", "D");
            Console.Write(movements.Count() - matches.Count);
        }
    }
}

using System;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int result = n;
        string input = Console.ReadLine();
        char prev = '0';
        char next = '0';

        for (int i = 0; i < n; i++)
        {
            next = input[i];
            if ((next == 'U' && prev == 'R') || (next == 'R' && prev == 'U'))
            {
                prev = '0';
                result--;
            }
            else
                prev = next;
        }

        Console.WriteLine(result);

    }
}

using System;
namespace codeforces954A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            int cnt = 0;
            for (int i = 0; i < n - 1; i++)
            {
                if ((s[i] == 'R' && s[i + 1] == 'U') || (s[i] == 'U' && s[i + 1] == 'R'))
                {
                    cnt++;
                    i++;
                }
            }

            Console.WriteLine(cnt+(n-cnt*2));
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
//using mystruct = System.Int64;

public sealed class Solution : CoreLibs
{
    internal static void __initStatic()
    {
        initSTDIO(false);
        //
    }
    public void __main(int _TCID = 1)
    {
        //Console.WriteLine();    // newline after "Case #1: "
        checked
        {
            var n = readLong64();
            var s = Select(n, readSingleChar).ll();
            var ll = new LinkedList<char>(s);
            var curr = ll.First;
            while (curr.Next != null)
            {
                curr = curr.Next;
                if (curr.Previous.Value != 'd' && curr.Value != curr.Previous.Value)
                {
                    curr = ll.AddAfter(curr, 'd');
                    ll.Remove(curr.Previous.Previous);
                    ll.Remove(curr.Previous);
                }
            }
            Debug.WriteLine(ll.stringify());
            writeNumber(ll.Count);
            //
            Console.WriteLine();    // newline before next test-case
        }
    }
    //
}

// additional plugable library
public partial class CoreLibs
{

    //
    #region STDIO
#if !DEBUG
    static void Main() { __stdioMain(); }
#endif
    static void __stdioMain()
    {
        Console.SetIn(new System.IO.StreamReader(new System.IO.BufferedStream(Console.OpenStandardInput())));
        if (!INTERACTIVE_FLUSH) Console.SetOut(new System.IO.StreamWriter(new System.IO.BufferedStream(Console.OpenStandardOutput())));
        var cnt = MULTI_TCs ? int.Parse(Console.ReadLine()) : 1;
        for (var i = 1; i <= cnt; i++)
        {
            if (WRITE_TCASE_NUMBER) Console.Write("Case #{0}: ", i);
            new Solution().__main(i);
        }
        Console.Out.Flush();
    }
    static bool INIT, MULTI_TCs, INTERACTIVE_FLUSH, WRITE_TCASE_NUMBER;
    internal static void initSTDIO(bool multiTCs, bool writeTcaseNumber = false, bool interactiveFlush = false)
    {
        INIT = true; MULTI_TCs = multiTCs; WRITE_TCASE_NUMBER = writeTcaseNumber; INTERACTIVE_FLUSH = interactiveFlush;
    }
    int validateInitCtor = 1 / (INIT ? 1 : 0);
    // OUTput
    internal string separatorAutoString;
    internal void writeLine() { Console.WriteLine(); }
    internal void writeSeparator() { if (!string.IsNullOrEmpty(separatorAutoString)) { Console.Write(separatorAutoString); } }
    internal void writeText(char c) { Console.Write(c); writeSeparator(); }
    internal void writeText(string s) { Console.Write(s); writeSeparator(); }
    internal void writeNumber(long i64) { Console.Write(i64); writeSeparator(); }
    internal void writeNumber(int i32) { Console.Write(i32); writeSeparator(); }
    internal void writeNumber(double dec) { Console.Write(dec); writeSeparator(); }
    // INput
    static void EOF() { throw new System.IO.EndOfStreamException(); }
    static IEnumerable<char> stream() { while (true) { var iread = Console.Read(); if (iread < 0) break; yield return (char)iread; } }
    static bool isWhitespace(char c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t'; }
    static System.Text.StringBuilder sb = new System.Text.StringBuilder(30);
    internal static string readWordString()
    {
        sb.Clear();
        var iter = stream().SkipWhile(isWhitespace).TakeWhile(c => !isWhitespace(c));
        foreach (var c in iter) sb.Append(c);
        if (sb.Length == 0) EOF(); return sb.ToString();
    }
    internal static long readLong64() { return long.Parse(readWordString()); }
    internal static char readSingleChar() { return stream().SkipWhile(isWhitespace).First(); }
    #endregion
}
static partial class CoreExtension
{

    //

}

#region Core helper library
[DebuggerNonUserCode]
public partial class CoreLibs
{
    static CoreLibs() { Solution.__initStatic(); }
    internal static IEnumerable<long> seq(long low, long high, int skip = 1) { checked { for (var i = low; i <= high; i += skip) yield return i; } }
    internal static IEnumerable<long> rev(long low, long high, int skipPositive = 1) { checked { for (var i = high; i >= low; i -= skipPositive) yield return i; } }
    internal static T[] collect<T>(params T[] elemS) { return elemS; }
    internal static T? optional<T>(bool hasValue, T value) where T : struct { return hasValue ? new T?(value) : null; }
    internal static T identity<T>(T obj) { return obj; }
    internal static T? optional<T>(T value) where T : struct { return value; }
    internal static void assert(bool truthy) { if (!truthy) { pause(); var a = 0; a /= a; } }
    internal static void assert<T>(T actual, T expected) { if (!Equals(actual, expected)) { Debug.WriteLine("SALAH {0} / BENAR {1}", actual, expected); assert(false); } }
    [Conditional("DEBUG")]
    internal static void pause(bool truthy = true) { Debug.Assert(!truthy); }
    internal static List<T> ll<T>(T emptyExample) { return new List<T>(); }
    internal static T? optional<T>(bool hasValue, Func<T> calc) where T : struct { return hasValue ? calc() : new T?(); }
    internal static long countLength(long left, long right) { return left > right ? 0 : checked(right - left + 1); }
    internal static long getRight(long left, long count) { return checked(left + count - 1); }
    internal static long getLeft(long count, long right) { return checked(right - count + 1); }
    internal static double div(double a, double b) { return a / b; }
    internal static void elect(long count, Action act) { while (count-- > 0) act(); }
    internal static IEnumerable<T> Select<T>(long count, Func<T> getter) { while (count-- > 0) yield return getter(); }
}
[DebuggerNonUserCode]
static partial class CoreExtension
{
    internal static IEnumerable<T> elect<T>(this IEnumerable<T> stream, Action<T> act) { foreach (var elem in stream) act(elem); return stream; }
    internal static List<KeyValuePair<int, T>> ToKvpList<T>(this IEnumerable<T> list) { return list.Select((elem, idx) => new KeyValuePair<int, T>(idx, elem)).ToList(); }
    internal static IEnumerable<T> SelectElement<T>(this IEnumerable<long> indices, IList<T> lst) { return indices.Select(Convert.ToInt32).Select(i => lst[i]); }
    internal static int int32(this long val) { return Convert.ToInt32(val); }
    internal static long long64(this int val) { return val; }
    internal static int int32(this int val) { return val; }
    internal static long long64(this long val) { return val; }
    internal static T? optional<T>(this T value) where T : struct { return value; }
    internal static IEnumerable<T?> optional<T>(this IEnumerable<T> stream) where T : struct { return stream.Select(optional); }
    internal static long skip(this long src, long skipSigned) { return checked(src + skipSigned); }
    internal static int? explainSearchIndex(this int rawIndex) { if (rawIndex < 0) return null; return rawIndex; }
    internal static T[] sort<T>(this T[] arr) { Array.Sort(arr); return arr; }
    internal static List<T> sort<T>(this List<T> lst) { lst.Sort(); return lst; }
    //
    internal static T? AggregateOrNullable<T>(this IEnumerable<T> stream, Func<T, T, T> merge_CHECKED) where T : struct
    { var it = stream.GetEnumerator(); if (!it.MoveNext()) return null; var res = it.Current; while (it.MoveNext()) res = merge_CHECKED(res, it.Current); return res; }
    internal static long sumLong64(this IEnumerable<int> stream) { return stream.Sum(x => (long)x); }
    internal static T[] ll<T>(this IEnumerable<T> stream) { return stream.ToArray(); }
    //internal static IEnumerable<int> seq<T>(this IList<T> list) { for (var i = 0; i < list.Count; i++) yield return i; }
    //internal static IEnumerable<int> rev<T>(this IList<T> list) { for (var i = list.Count - 1; i >= 0; i--) yield return i; }
    internal static int getUpperBound<T>(this IList<T> list) { return list.Count - 1; }
    internal static int GetUpperBound(this System.Collections.IList list) { return list.Count - 1; }
    internal static T? elementAtOrNullable<T>(this IList<T> list, int index) where T : struct { if (index < 0 || index >= list.Count) return null; return list[index]; }
    internal static string stringify(this IEnumerable<char> stream) { return new string(stream.ToArray()); }
}
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
//using mystruct = System.Int64;

public sealed class Solution : CoreLibs
{
    internal static void __initStatic()
    {
        initSTDIO(false);
        //
    }
    public void __main(int _TCID = 1)
    {
        //Console.WriteLine();    // newline after "Case #1: "
        checked
        {
            var n = readLong64();
            var s = repeat(n, readSingleChar).ll();
            Func<int, int> rec = null;
            rec = i =>
            {
                if (i + 1 < n)
                {
                    if (s[i] == s[i + 1])
                        return 1 + rec(i + 1);
                    else
                        return 1 + rec(i + 2);
                }
                if (i < n)
                    return 1;
                return 0;
            };
            writeNumber(rec(0));
            //
            Console.WriteLine();    // newline before next test-case
        }
    }
    //
}

// additional plugable library
public partial class CoreLibs
{

    //
    #region STDIO
#if !DEBUG
    static void Main() { __stdioMain(); }
#endif
    static void __stdioMain()
    {
        Console.SetIn(new System.IO.StreamReader(new System.IO.BufferedStream(Console.OpenStandardInput())));
        if (!INTERACTIVE_FLUSH) Console.SetOut(new System.IO.StreamWriter(new System.IO.BufferedStream(Console.OpenStandardOutput())));
        var cnt = MULTI_TCs ? int.Parse(Console.ReadLine()) : 1;
        for (var i = 1; i <= cnt; i++)
        {
            if (WRITE_TCASE_NUMBER) Console.Write("Case #{0}: ", i);
            new Solution().__main(i);
        }
        Console.Out.Flush();
    }
    static bool INIT, MULTI_TCs, INTERACTIVE_FLUSH, WRITE_TCASE_NUMBER;
    internal static void initSTDIO(bool multiTCs, bool writeTcaseNumber = false, bool interactiveFlush = false)
    {
        INIT = true; MULTI_TCs = multiTCs; WRITE_TCASE_NUMBER = writeTcaseNumber; INTERACTIVE_FLUSH = interactiveFlush;
    }
    int validateInitCtor = 1 / (INIT ? 1 : 0);
    // OUTput
    internal string separatorAutoString;
    internal void writeLine() { Console.WriteLine(); }
    internal void writeSeparator() { if (!string.IsNullOrEmpty(separatorAutoString)) { Console.Write(separatorAutoString); } }
    internal void writeText(char c) { Console.Write(c); writeSeparator(); }
    internal void writeText(string s) { Console.Write(s); writeSeparator(); }
    internal void writeNumber(long i64) { Console.Write(i64); writeSeparator(); }
    internal void writeNumber(int i32) { Console.Write(i32); writeSeparator(); }
    internal void writeNumber(double dec) { Console.Write(dec); writeSeparator(); }
    // INput
    static void EOF() { throw new System.IO.EndOfStreamException(); }
    static IEnumerable<char> stream() { while (true) { var iread = Console.Read(); if (iread < 0) break; yield return (char)iread; } }
    static bool isWhitespace(char c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t'; }
    static System.Text.StringBuilder sb = new System.Text.StringBuilder(30);
    internal static string readWordString()
    {
        sb.Clear();
        var iter = stream().SkipWhile(isWhitespace).TakeWhile(c => !isWhitespace(c));
        foreach (var c in iter) sb.Append(c);
        if (sb.Length == 0) EOF(); return sb.ToString();
    }
    internal static long readLong64() { return long.Parse(readWordString()); }
    internal static char readSingleChar() { return stream().SkipWhile(isWhitespace).First(); }
    #endregion
}
static partial class CoreExtension
{

    //

}

#region Core helper library
[DebuggerNonUserCode]
public partial class CoreLibs
{
    static CoreLibs() { Solution.__initStatic(); }
    internal static IEnumerable<long> seq(long low, long high, int skip = 1) { checked { for (var i = low; i <= high; i += skip) yield return i; } }
    internal static IEnumerable<long> rev(long low, long high, int skipPositive = 1) { checked { for (var i = high; i >= low; i -= skipPositive) yield return i; } }
    internal static T[] collect<T>(params T[] elemS) { return elemS; }
    internal static T? optional<T>(bool hasValue, T value) where T : struct { return hasValue ? new T?(value) : null; }
    internal static T identity<T>(T obj) { return obj; }
    internal static T? optional<T>(T value) where T : struct { return value; }
    internal static void assert(bool truthy) { if (!truthy) { pause(); var a = 0; a /= a; } }
    internal static void assert<T>(T actual, T expected) { if (!Equals(actual, expected)) { Debug.WriteLine("SALAH {0} / BENAR {1}", actual, expected); assert(false); } }
    [Conditional("DEBUG")]
    internal static void pause(bool truthy = true) { Debug.Assert(!truthy); }
    internal static List<T> ll<T>(T emptyExample) { return new List<T>(); }
    internal static T? optional<T>(bool hasValue, Func<T> calc) where T : struct { return hasValue ? calc() : new T?(); }
    internal static long countLength(long left, long right) { return left > right ? 0 : checked(right - left + 1); }
    internal static long getRight(long left, long count) { return checked(left + count - 1); }
    internal static long getLeft(long count, long right) { return checked(right - count + 1); }
    internal static double div(double a, double b) { return a / b; }
    internal static void loop(long count, Action act) { while (count-- > 0) act(); }
    internal static IEnumerable<T> repeat<T>(long count, Func<T> getter) { while (count-- > 0) yield return getter(); }
}
[DebuggerNonUserCode]
static partial class CoreExtension
{
    internal static IEnumerable<T> elect<T>(this IEnumerable<T> stream, Action<T> act) { foreach (var elem in stream) act(elem); return stream; }
    internal static List<KeyValuePair<int, T>> ToKvpList<T>(this IEnumerable<T> list) { return list.Select((elem, idx) => new KeyValuePair<int, T>(idx, elem)).ToList(); }
    internal static IEnumerable<T> SelectElement<T>(this IEnumerable<long> indices, IList<T> lst) { return indices.Select(Convert.ToInt32).Select(i => lst[i]); }
    internal static int int32(this long val) { return Convert.ToInt32(val); }
    internal static long long64(this int val) { return val; }
    internal static int int32(this int val) { return val; }
    internal static long long64(this long val) { return val; }
    internal static T? optional<T>(this T value) where T : struct { return value; }
    internal static IEnumerable<T?> optional<T>(this IEnumerable<T> stream) where T : struct { return stream.Select(optional); }
    internal static long skip(this long src, long skipSigned) { return checked(src + skipSigned); }
    internal static int? explainSearchIndex(this int rawIndex) { if (rawIndex < 0) return null; return rawIndex; }
    internal static T[] sort<T>(this T[] arr) { Array.Sort(arr); return arr; }
    internal static List<T> sort<T>(this List<T> lst) { lst.Sort(); return lst; }
    //
    internal static T? AggregateOrNullable<T>(this IEnumerable<T> stream, Func<T, T, T> merge_CHECKED) where T : struct
    { var it = stream.GetEnumerator(); if (!it.MoveNext()) return null; var res = it.Current; while (it.MoveNext()) res = merge_CHECKED(res, it.Current); return res; }
    internal static long sumLong64(this IEnumerable<int> stream) { return stream.Sum(x => (long)x); }
    internal static T[] ll<T>(this IEnumerable<T> stream) { return stream.ToArray(); }
    //internal static IEnumerable<int> seq<T>(this IList<T> list) { for (var i = 0; i < list.Count; i++) yield return i; }
    //internal static IEnumerable<int> rev<T>(this IList<T> list) { for (var i = list.Count - 1; i >= 0; i--) yield return i; }
    internal static int getUpperBound<T>(this IList<T> list) { return list.Count - 1; }
    internal static int GetUpperBound(this System.Collections.IList list) { return list.Count - 1; }
    internal static T? elementAtOrNullable<T>(this IList<T> list, int index) where T : struct { if (index < 0 || index >= list.Count) return null; return list[index]; }
    internal static string stringify(this IEnumerable<char> stream) { return new string(stream.ToArray()); }
}
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
//using mystruct = System.Int64;

public sealed class Solution : Helper
{
    //
    public void __main(int _TCID = 1)
    {
        checked
        {
            //
            var n = readLong64();
            var s = readWordString().ToCharArray();
            var dp = (n + 7).Select(() => new ValueRefPointer<long>()).ll();
            dp[0].ValueNullable = 0;
            dp[1].ValueNullable = 1;
            seq(0, n - 1).elect(i =>
              {
                  var a = s[i];
                  var c = dp[i].ValueNullable ?? i;
                  dp[i + 1].UpdateCompute(c + 1, Math.Min);
                  if (i + 1 < n)
                  {
                      var b = s[i + 1];
                      if (a != b)
                          dp[i + 2].UpdateCompute(c + 1, Math.Min);
                  }
              });
            writeNumber(dp[n].ValueNullable ?? 1);
            writeLine();
        }
    }
    //
}

// additional plugable library
public partial class Helper
{
    //
    static bool MULTI_TCs = false;
    #region STDIO
#if !DEBUG
    static void Main() { __stdioMain(); }
#endif
    static void __stdioMain()
    {
        Console.SetIn(new System.IO.StreamReader(new System.IO.BufferedStream(Console.OpenStandardInput())));
        Console.SetOut(new System.IO.StreamWriter(new System.IO.BufferedStream(Console.OpenStandardOutput())));
        var cnt = MULTI_TCs ? int.Parse(Console.ReadLine()) : 1;
        for (var i = 1; i <= cnt; i++) new Solution().__main(i);
        Console.Out.Flush();
    }
    // OUTput
    internal string separatorAutoString;
    internal void writeLine() { Console.WriteLine(); }
    internal void writeSeparator() { if (!string.IsNullOrEmpty(separatorAutoString)) { Console.Write(separatorAutoString); } }
    internal void writeText(char c) { Console.Write(c); writeSeparator(); }
    internal void writeText(string s) { Console.Write(s); writeSeparator(); }
    internal void writeNumber(long i64) { Console.Write(i64); writeSeparator(); }
    internal void writeNumber(int i32) { Console.Write(i32); writeSeparator(); }
    internal void writeNumber(double dec) { Console.Write(dec); writeSeparator(); }
    // INput
    static void EOF() { throw new System.IO.EndOfStreamException(); }
    static IEnumerable<char> stream() { while (true) { var iread = Console.Read(); if (iread < 0) break; yield return (char)iread; } }
    static bool isWhitespace(char c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t'; }
    static System.Text.StringBuilder sb = new System.Text.StringBuilder(30);
    internal static string readWordString()
    {
        sb.Clear();
        var iter = stream().SkipWhile(isWhitespace).TakeWhile(c => !isWhitespace(c));
        foreach (var c in iter) sb.Append(c);
        if (sb.Length == 0) EOF(); return sb.ToString();
    }
    internal static long readLong64() { return long.Parse(readWordString()); }
    internal static char readSingleChar() { return stream().SkipWhile(isWhitespace).First(); }
    #endregion
    //
    internal class ValueRefPointer<T> where T : struct
    {
        public T? ValueNullable;
        public ValueRefPointer<T> IfAbsent(Action<ValueRefPointer<T>> init) { if (ValueNullable == null) init(this); return this; }
        public ValueRefPointer<T> UpdateIfAbsent(Func<T> calc) { if (ValueNullable == null) ValueNullable = calc(); return this; }
        public ValueRefPointer<T> UpdateCompute(T other, Func<T, T, T> merge_CHECKED) { var ans = other; if (ValueNullable.HasValue) ans = merge_CHECKED(other, ValueNullable.Value); ValueNullable = ans; return this; }
        public ValueRefPointer<T> UpdateCompute(T? other, Func<T, T, T> merge_CHECKED) { if (other.HasValue) UpdateCompute(other.Value, merge_CHECKED); return this; }
        public ValueRefPointer<T> Swap(ValueRefPointer<T> with) { var temp = ValueNullable; ValueNullable = with.ValueNullable; with.ValueNullable = temp; return this; }
        //TODO switch to implicit cast from ValueRefPointer to T?
        public ValueRefPointer<T> UpdateCompute(ValueRefPointer<T> other, Func<T, T, T> merge_CHECKED) { return UpdateCompute(other.ValueNullable, merge_CHECKED); }
        public override string ToString() { return ValueNullable.ToString(); }
    }
}
static partial class Extension
{
    //

    //
}

#region Core helper library
[DebuggerNonUserCode]
public partial class Helper
{
    internal static IEnumerable<long> seq(long low, long high, int skip = 1) { checked { for (var i = low; i <= high; i += skip) yield return i; } }
    internal static IEnumerable<long> rev(long low, long high, int skipPositive = 1) { checked { for (var i = high; i >= low; i -= skipPositive) yield return i; } }
    internal static T[] collect<T>(params T[] elemS) { return elemS; }
    internal static T? optional<T>(bool hasValue, T value) where T : struct { return hasValue ? new T?(value) : null; }
    internal static T identity<T>(T obj) { return obj; }
    internal static T? optional<T>(T value) where T : struct { return value; }
    internal static void assert(bool truthy) { if (!truthy) { var a = 0; a /= a; } }
    internal static void assert<T>(T actual, T expected) { if (!Equals(actual, expected)) { Debug.WriteLine("SALAH {0} / BENAR {1}", actual, expected); assert(false); } }
    [Conditional("DEBUG")]
    internal static void debug(bool truthy) { Debug.Assert(truthy); }
    internal static List<T> ll<T>(T emptyExample) { return new List<T>(); }
    internal static T? optional<T>(bool hasValue, Func<T> calc) where T : struct { return hasValue ? calc() : new T?(); }
    internal static long countLength(long left, long right) { return left > right ? 0 : checked(right - left + 1); }
    internal static long getRight(long left, long count) { return checked(left + count - 1); }
    internal static long getLeft(long count, long right) { return checked(right - count + 1); }
    static double div(double a, double b) { return a / b; }
}
[DebuggerNonUserCode]
static partial class Extension
{
    internal static IEnumerable<T> elect<T>(this IEnumerable<T> stream, Action<T> act) { foreach (var elem in stream) act(elem); return stream; }
    internal static IEnumerable<T> Select<T>(this long count, Func<T> getter) { while (count-- > 0) yield return getter(); }
    internal static void elect(this long count, Action act) { while (count-- > 0) act(); }
    internal static List<KeyValuePair<int, T>> ToKvpList<T>(this IEnumerable<T> list) { return list.Select((elem, idx) => new KeyValuePair<int, T>(idx, elem)).ToList(); }
    internal static IEnumerable<T> SelectElement<T>(this IEnumerable<long> indices, IList<T> lst) { return indices.Select(Convert.ToInt32).Select(i => lst[i]); }
    internal static int int32(this long val) { return Convert.ToInt32(val); }
    internal static long long64(this int val) { return val; }
    internal static T? optional<T>(this T value) where T : struct { return value; }
    internal static IEnumerable<T?> optional<T>(this IEnumerable<T> stream) where T : struct { return stream.Select(optional); }
    internal static long skip(this long src, long skipSigned) { return checked(src + skipSigned); }
    //
    internal static T? AggregateOrNullable<T>(this IEnumerable<T> stream, Func<T, T, T> merge_CHECKED) where T : struct
    { var it = stream.GetEnumerator(); if (!it.MoveNext()) return null; var res = it.Current; while (it.MoveNext()) res = merge_CHECKED(res, it.Current); return res; }
    internal static long sumLong64(IEnumerable<int> stream) { return stream.Sum(x => (long)x); }
    internal static int? explainSearchIndex(this int rawIndex) { if (rawIndex < 0) return null; return rawIndex; }
    internal static T[] ll<T>(this IEnumerable<T> stream) { return stream.ToArray(); }
    internal static T[] sort<T>(this T[] arr) { Array.Sort(arr); return arr; }
    internal static List<T> sort<T>(this List<T> lst) { lst.Sort(); return lst; }
    //internal static IEnumerable<int> seq<T>(this IList<T> list) { for (var i = 0; i < list.Count; i++) yield return i; }
    //internal static IEnumerable<int> rev<T>(this IList<T> list) { for (var i = list.Count - 1; i >= 0; i--) yield return i; }
    internal static int getUpperBound<T>(this IList<T> list) { return list.Count - 1; }
    internal static int GetUpperBound(this System.Collections.IList list) { return list.Count - 1; }
    internal static T? elementAtOrNullable<T>(this IList<T> list, int index) where T : struct { if (index < 0 || index >= list.Count) return null; return list[index]; }
    internal static string stringify(this IEnumerable<char> stream) { return new string(stream.ToArray()); }
}
#endregion

using System;

namespace CSharp
{
    public class _954A
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            int length = 0;

            for (int i = 0; i < n; i++, length++)
            {
                if (i + 1 < n && s[i] != s[i + 1])
                {
                    i++;
                }
            }

            Console.WriteLine(length);
        }
    }
}

using System;
using System.Linq;
using CompLib.Util;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        string s = sc.Next();

        int ans = 1;
        bool f = true;
        for (int i = 1; i < n; i++)
        {
            bool ru = s[i - 1] == 'R' && s[i] == 'U';
            bool ur = s[i - 1] == 'U' && s[i] == 'R';
            if (f && (ru || ur))
            {
                f = false;
            }
            else
            {
                ans++;
                f = true;
            }
        }

        Console.WriteLine(ans);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

using System;

namespace Junior
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = Convert.ToInt32(Console.ReadLine());
            string s = Console.ReadLine();
            int count = 0;

            for (int i = 0; i < a - 1; i++)
            {
                if (s[i] != s[i + 1])
                {
                    i++;
                    count++;
                }
            }
            Console.WriteLine(a - count);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SubScore
{
    class Student : IComparable<Student>
    {

        public int id = -1;
        public string name = "";
        public int totalscode = 0;
        public int tc = 0;
        public List<int> scode = new List<int>();
        public Student(int IRN, string name)
        {
            this.id = IRN;
            this.name = name;
        }

        public void AddGrade(int grade)
        {
            if (grade >= 50)
            {
                scode.Add(grade);
                totalscode = scode.Sum();
                totalscode = totalscode / scode.Count;
                tc += 4;
            }
        }

        public int CompareTo(Student other)
        {
            if (this.totalscode == other.totalscode) return this.id.CompareTo(other.id);
            return other.totalscode.CompareTo(this.totalscode);

        }

    }

    public class program
    {
        static void Main(string[] args)
        {

            StringBuilder result = new StringBuilder();
            int n = NextInt();
            string m = Next();
            int temb = 0;
            for (int i = 1; i < n;i++)
            {
                if (m[i].ToString() + m[i - 1].ToString() == "UR" || m[i].ToString() + m[i - 1].ToString() == "RU")
                {
                    temb++;
                    i++;
                }
            }
                Console.WriteLine(n-temb);
            Console.ReadLine();

        }
        #region Input wrapper

        static int s_index = 0;
        static string[] s_tokens;

        private static string Next()
        {
            while (s_tokens == null || s_index == s_tokens.Length)
            {
                s_tokens = Console.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                s_index = 0;
            }
            return s_tokens[s_index++];
        }

        private static int NextInt()
        {
            return Int32.Parse(Next());
        }

        private static long NextLong()
        {
            return Int64.Parse(Next());
        }

        #endregion
    }

}

using System;
using System.Text;

namespace AlgoTasks
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            StringBuilder sb = new StringBuilder(Console.ReadLine());
            int c = 0;
            int initLen = sb.Length;
            for(int i = 0; i < sb.Length - 1; i++)
            {
                if ((sb[i] == 'U' && sb[i + 1] == 'R') || (sb[i] == 'R' && sb[i + 1] == 'U'))
                {
                    sb.Remove(i, 2);
                    sb.Insert(i, 'D');
                    c++;
                }

            }
            Console.WriteLine(initLen - c);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            //string q = Console.ReadLine();
            //string q1 = Console.ReadLine();
            //for (int i = 0; i < q.Length; i++)
            //{
            //    Console.WriteLine(b[i]);
            //}
            int a = int.Parse(Console.ReadLine());
            string b = Console.ReadLine();
            int dsf = a;
            for (int i = 0; i < a-1; i++)
            {
                if (((b[i] == 'R') && (b[i + 1] == 'U')) || ((b[i] == 'U') && (b[i + 1] == 'R')))
                {
                    dsf--;
                    i++;
                }
            }
            Console.WriteLine(dsf);
            //Console.ReadKey();
        }
    }
}

using System;

namespace csharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            String s = Console.ReadLine();
            String s2 = s;

            string d1 = "RU";
            string d2 = "UR";

            for(int i = 0; i< s.Length -1; i ++)
            {
                if((s[i] == d1[0] && s[i+1] == d1[1]) || (s[i] == d2[0] && s[i+1] == d2[1]))
                {
                    n --;
                    i++;
                }
            }

            Console.WriteLine(n);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace CodeForces
{
    class Program
    {

        static void Main(string[] args)
        {
            int number = int.Parse(Console.ReadLine());
            string way = Console.ReadLine();
            for (int i = 0; i < way.Length-1; i++)
            {
                if (way[i] != way[i + 1])
                {
                    number -= 1;
                    i++;
                }

            }
            Console.WriteLine(number);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A.Diagonal_Walking
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int res = 0;
            string s = Console.ReadLine();
            here:
            for (int i = 0; i < n; i++)
            {
                if (i + 1>= s.Length){break;}
                if (s[i] == 'U' && s[i + 1] == 'R' || s[i] == 'R' && s[i + 1] == 'U')
                {
                    s = s.Remove(i, 2);
                    res++;
                    goto here;
                }
                else
                {
                    res++;
                    s = s.Remove(i, 1);
                    goto here;
                }
            }
            if (s.Length > 0) res++;
            Console.WriteLine(res);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HodbaDiag
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            int count = 0;
            int i = 0;
            while (i < n)
            {
                if (i<n-1 && s[i]!=s[i+1])
                   i+=2;
                else
                   i++;

                count++;
            }
            Console.Write(count);
       }
    }
}

using System;
using System.IO;
using System.Text;

namespace Diagonal_Walking
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve(args));
            writer.Flush();
        }

        private static int Solve(string[] args)
        {
            string s = reader.ReadLine();
            s = reader.ReadLine();

            int ans = 0;
            char p = 't';
            foreach (var c in s)
            {
                if (c == 'R' && p == 'U' || c == 'U' && p == 'R')
                {
                    p = 't';
                }
                else
                {
                    ans++;
                    p = c;
                }
            }

            return ans;
        }
    }
}

using System;
namespace _954A
{
	class Program
	{
		public static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			string s = Console.ReadLine();
			while (true)
			{
				int pos1 = s.IndexOf("UR");
				int pos2 = s.IndexOf("RU");
				if (pos1 == -1 && pos2 == -1)
					break;
				int pos;
				if (pos1 == -1)
					pos = pos2;
				else if (pos2 == -1)
					pos = pos1;
				else
					pos = Math.Min(pos1, pos2);
				s = s.Substring(0, pos) + "D" + s.Substring(pos + 2);
			}
			Console.WriteLine(s.Length);
		}
	}
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace CF
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            using (var sr = new InputReader(Console.In))
//			using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
                //using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var str = sr.NextString();
            var answ = new StringBuilder();
            if (n == 1) {
                sw.WriteLine(1);
                return;
            }
            for (var i = 1; i < str.Length; i++) {
                if (str[i - 1] == 'U' && str[i] == 'R') {
                    answ.Append("D");
                    i++;
                    if (i == str.Length - 1) {
                        answ.Append(str[i]);
                    }
                }
                else {
                    if (str[i - 1] == 'R' && str[i] == 'U') {
                        answ.Append("D");
                        i++;
                        if (i == str.Length - 1) {
                            answ.Append(str[i]);
                        }
                    }
                    else {
                        answ.Append(str[i - 1]);
                        if (i + 1 == str.Length) {
                            answ.Append(str[i]);
                        }
                    }
                }
            }

            sw.Write(answ.Length);
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;

namespace CodeforcesTemplate
{
    public static class Permutation
    {
        private static bool Next(ref int[] arr)
        {
            int k, j, l;
            for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }
            if (j == -1)
            {
                arr = arr.OrderBy(c => c).ToArray();
                return false;
            }
            for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }
            var tmp = arr[j];
            arr[j] = arr[l];
            arr[l] = tmp;
            for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)
            {
                tmp = arr[k];
                arr[k] = arr[l];
                arr[l] = tmp;
            }
            return true;
        }
        public static IEnumerable<int[]> AllPermutations(int[] arr)
        {
            do yield return arr;
            while (Next(ref arr));
        }
    }

    class Program
    {
        private const string FILENAME = "distance4";

        private const string INPUT = FILENAME + ".in";

        private const string OUTPUT = FILENAME + ".out";

        private static Stopwatch _stopwatch = new Stopwatch();

        private static StreamReader _reader = null;
        private static StreamWriter _writer = null;

        private static string[] _curLine;
        private static int _curTokenIdx;

        private static char[] _whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public static string Check(string s)
        {
            string letters = "aeiouy";

            while (true)
            {
                bool used = false;

                for (int i = 0; i < s.Length - 1; i++)
                {
                    if (letters.Contains(s[i].ToString()) && letters.Contains(s[i + 1].ToString()))
                    {
                        s = s.Remove(i + 1, 1);

                        used = true;
                    }
                }

                if (!used)
                {
                    return s;
                }
            }
        }

        private static string ReadNextToken()
        {
            if (_curTokenIdx >= _curLine.Length)
            {
                //Read next line
                string line = _reader.ReadLine();
                if (line != null)
                    _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    _curLine = new string[] { };
                _curTokenIdx = 0;
            }

            if (_curTokenIdx >= _curLine.Length)
                return null;

            return _curLine[_curTokenIdx++];
        }

        private static int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        private static void RunTimer()
        {
#if (DEBUG)

            _stopwatch.Start();

#endif
        }

        private static void Main(string[] args)
        {

#if (DEBUG)
            double before = GC.GetTotalMemory(false);
#endif

            int n = int.Parse(Console.ReadLine());

            char[] a = Console.ReadLine().ToCharArray();

            int res = 0;

            for (int i = 0; i < n; i++)
            {
                if (i == n - 1)
                {
                    res++;
                }
                else
                {

                    if (((a[i] == 'R') && (a[i + 1] == 'U')) || ((a[i] == 'U') && (a[i + 1] == 'R')))
                    {
                        res++;
                        i++;
                    }
                    else
                    {
                        res++;
                    }
                }
            }

            Console.WriteLine(res);

#if (DEBUG)
            _stopwatch.Stop();

            double after = GC.GetTotalMemory(false);

            double consumedInMegabytes = (after - before) / (1024 * 1024);

            Console.WriteLine($"Time elapsed: {_stopwatch.Elapsed}");

            Console.WriteLine($"Consumed memory (MB): {consumedInMegabytes}");

            Console.ReadKey();
#endif

        }

        private static int CountLeadZeros(string source)
        {
            int countZero = 0;

            for (int i = source.Length - 1; i >= 0; i--)
            {
                if (source[i] == '0')
                {
                    countZero++;
                }

                else
                {
                    break;
                }

            }

            return countZero;
        }

        private static string ReverseString(string source)
        {
            char[] reverseArray = source.ToCharArray();

            Array.Reverse(reverseArray);

            string reversedString = new string(reverseArray);

            return reversedString;
        }

        private static int[] CopyOfRange(int[] src, int start, int end)
        {
            int len = end - start;
            int[] dest = new int[len];
            Array.Copy(src, start, dest, 0, len);
            return dest;
        }

        private static string StreamReader()
        {

            if (_reader == null)
                _reader = new StreamReader(INPUT);
            string response = _reader.ReadLine();
            if (_reader.EndOfStream)
                _reader.Close();
            return response;

        }

        private static void StreamWriter(string text)
        {

            if (_writer == null)
                _writer = new StreamWriter(OUTPUT);
            _writer.WriteLine(text);

        }

        private static int BFS(int start, int end, int[,] arr)
        {
            Queue<KeyValuePair<int, int>> queue = new Queue<KeyValuePair<int, int>>();
            List<bool> visited = new List<bool>();
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                visited.Add(false);
            }

            queue.Enqueue(new KeyValuePair<int, int>(start, 0));
            KeyValuePair<int, int> node;
            int level = 0;
            bool flag = false;

            while (queue.Count != 0)
            {
                node = queue.Dequeue();
                if (node.Key == end)
                {
                    return node.Value;
                }
                flag = false;
                for (int i = 0; i < arr.GetLength(0); i++)
                {

                    if (arr[node.Key, i] == 1)
                    {
                        if (visited[i] == false)
                        {
                            if (!flag)
                            {
                                level = node.Value + 1;
                                flag = true;
                            }
                            queue.Enqueue(new KeyValuePair<int, int>(i, level));
                            visited[i] = true;
                        }
                    }
                }

            }
            return 0;

        }

        private static void Write(string source)
        {
            File.WriteAllText(OUTPUT, source);
        }

        private static string ReadString()
        {
            return File.ReadAllText(INPUT);
        }

        private static void WriteStringArray(string[] source)
        {
            File.WriteAllLines(OUTPUT, source);
        }

        private static string[] ReadStringArray()
        {
            return File.ReadAllLines(INPUT);
        }

        private static int[] GetIntArray()
        {
            return ReadString().Split(' ').Select(int.Parse).ToArray();
        }

        private static double[] GetDoubleArray()
        {
            return ReadString().Split(' ').Select(double.Parse).ToArray();
        }

        private static int[,] ReadINT2XArray(List<string> lines)
        {
            int[,] arr = new int[lines.Count, lines.Count];

            for (int i = 0; i < lines.Count; i++)
            {
                int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();

                for (int j = 0; j < lines.Count; j++)
                {
                    arr[i, j] = row[j];
                }
            }

            return arr;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{
   class A
   {
      static void Main(string[] args)
      {
         int n = int.Parse(Console.ReadLine());
         string s = Console.ReadLine();

         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++;
           }
         }

         Console.WriteLine(ans);
      }
   }
}

using System;
using System.CodeDom;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.InteropServices;
using System.Xml.Serialization;

class Program
{
    class A
    {
        public int a;
        public int b;
    }

    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var str = Console.ReadLine();
        int c = 0;
        for (int i = 0; i < str.Length-1; i++)
        {
            if (str[i] == 'R' && str[i + 1] == 'U')
            {
                c++;
                i++;
            }
            else if (str[i] == 'U' && str[i + 1] == 'R')
            {
                c++;
                i++;
            }
        }

        Console.WriteLine(n-c);
    }
}

/* Date: 22.03.2018 * Time: 21:45 */
// *

/*
�	fflush(stdout) � ����� C++;
�	System.out.flush() � Java;
�	stdout.flush() � Python;
�	flush(output) � Pascal;

*/

using System;
using System.Globalization;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

class Example
{
	public static void Main (string[] args)
	{
# if ( ! ONLINE_JUDGE )
		StreamReader sr = new StreamReader ("C:\\TRR\\2018\\Task\\07 Codeforces\\030\\A.TXT");
		StreamWriter sw = new StreamWriter ("C:\\TRR\\2018\\Task\\07 Codeforces\\030\\A.OUT");
# endif

		NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;

		int n;

# if ( ONLINE_JUDGE )
		n = int.Parse (Console.ReadLine ());
# else
		n = int.Parse (sr.ReadLine ());
# endif

		string s;

# if ( ONLINE_JUDGE )
		s = Console.ReadLine ();
# else
		s = sr.ReadLine ();
# endif

		char c = s [0];
		int k = 0;
		for ( int i=1; i < n; i++ )
		{
			if ( s [i] == 'R' && c == 'U' || s [i] == 'U' && c == 'R' )
			{
				k++;
				c = 'D';
			}
			else
				c = s [i];
		}

# if ( ONLINE_JUDGE )
		Console.WriteLine (n-k);
# else
		sw.WriteLine (n-k);
		sw.Close ();
# endif

	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Collections;
using System.Text;

public class CodeForces87
{
#if TEST
    // To set this go to Project -> Properties -> Build -> General -> Conditional compilation symbols: -> enter 'TEST' into text box.
    const bool testing = false;
#else
const bool testing = false;
#endif

    public abstract class Heap<T> : IEnumerable<T>
    {
        private const int InitialCapacity = 0;
        private const int GrowFactor = 2;
        private const int MinGrow = 1;

        private int _capacity = InitialCapacity;
        private T[] _heap = new T[InitialCapacity];
        private int _tail = 0;

        public int Count { get { return _tail; } }
        public int Capacity { get { return _capacity; } }

        protected Comparer<T> Comparer { get; private set; }
        protected abstract bool Dominates(T x, T y);

        protected Heap() : this(Comparer<T>.Default)
        {
        }

        protected Heap(Comparer<T> comparer) : this(Enumerable.Empty<T>(), comparer)
        {
        }

        protected Heap(IEnumerable<T> collection)
            : this(collection, Comparer<T>.Default)
        {
        }

        protected Heap(IEnumerable<T> collection, Comparer<T> comparer)
        {
            if (collection == null) throw new ArgumentNullException("collection");
            if (comparer == null) throw new ArgumentNullException("comparer");

            Comparer = comparer;

            foreach (var item in collection)
            {
                if (Count == Capacity)
                    Grow();

                _heap[_tail++] = item;
            }

            for (int i = Parent(_tail - 1); i >= 0; i--)
                BubbleDown(i);
        }

        public void Add(T item)
        {
            if (Count == Capacity)
                Grow();

            _heap[_tail++] = item;
            BubbleUp(_tail - 1);
        }

        private void BubbleUp(int i)
        {
            if (i == 0 || Dominates(_heap[Parent(i)], _heap[i]))
                return; //correct domination (or root)

            Swap(i, Parent(i));
            BubbleUp(Parent(i));
        }

        public T GetMin()
        {
            if (Count == 0) throw new InvalidOperationException("Heap is empty");
            return _heap[0];
        }

        public T ExtractDominating()
        {
            if (Count == 0) throw new InvalidOperationException("Heap is empty");
            T ret = _heap[0];
            _tail--;
            Swap(_tail, 0);
            BubbleDown(0);
            return ret;
        }

        private void BubbleDown(int i)
        {
            int dominatingNode = Dominating(i);
            if (dominatingNode == i) return;
            Swap(i, dominatingNode);
            BubbleDown(dominatingNode);
        }

        private int Dominating(int i)
        {
            int dominatingNode = i;
            dominatingNode = GetDominating(YoungChild(i), dominatingNode);
            dominatingNode = GetDominating(OldChild(i), dominatingNode);

            return dominatingNode;
        }

        private int GetDominating(int newNode, int dominatingNode)
        {
            if (newNode < _tail && !Dominates(_heap[dominatingNode], _heap[newNode]))
                return newNode;
            else
                return dominatingNode;
        }

        private void Swap(int i, int j)
        {
            T tmp = _heap[i];
            _heap[i] = _heap[j];
            _heap[j] = tmp;
        }

        private static int Parent(int i)
        {
            return (i + 1) / 2 - 1;
        }

        private static int YoungChild(int i)
        {
            return (i + 1) * 2 - 1;
        }

        private static int OldChild(int i)
        {
            return YoungChild(i) + 1;
        }

        private void Grow()
        {
            int newCapacity = _capacity * GrowFactor + MinGrow;
            var newHeap = new T[newCapacity];
            Array.Copy(_heap, newHeap, _capacity);
            _heap = newHeap;
            _capacity = newCapacity;
        }

        public IEnumerator<T> GetEnumerator()
        {
            return _heap.Take(Count).GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }

    public class MaxHeap<T> : Heap<T>
    {
        public MaxHeap()
            : this(Comparer<T>.Default)
        {
        }

        public MaxHeap(Comparer<T> comparer)
            : base(comparer)
        {
        }

        public MaxHeap(IEnumerable<T> collection, Comparer<T> comparer)
            : base(collection, comparer)
        {
        }

        public MaxHeap(IEnumerable<T> collection) : base(collection)
        {
        }

        protected override bool Dominates(T x, T y)
        {
            return Comparer.Compare(x, y) >= 0;
        }
    }

    public class MinHeap<T> : Heap<T>
    {
        public MinHeap()
            : this(Comparer<T>.Default)
        {
        }

        public MinHeap(Comparer<T> comparer)
            : base(comparer)
        {
        }

        public MinHeap(IEnumerable<T> collection) : base(collection)
        {
        }

        public MinHeap(IEnumerable<T> collection, Comparer<T> comparer)
            : base(collection, comparer)
        {
        }

        protected override bool Dominates(T x, T y)
        {
            return Comparer.Compare(x, y) <= 0;
        }
    }
    public delegate bool Pred(long listVal);
    // check if result == n-1
    static int lowerBound(List<long> list, Pred pred)
    {
        var lo = 0;
        var hi = list.Count - 1;
        while (lo < hi)
        {
            var mid = lo + (hi - lo) / 2;
            if (pred(list[mid]))
            {
                hi = mid;
            }
            else
            {
                lo = mid + 1;
            }
        }
        return lo;
    }
    private static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c < '0' || c > '9');
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res;
            res *= 10;
            res += c - '0';
        }
    }
    static int upperBound(List<long> list, Pred pred)
    {
        var lo = 0;
        var hi = list.Count - 1;
        while (lo < hi)
        {
            var mid = lo + (hi - lo + 1) / 2;
            if (pred(list[mid]))
            {
                lo = mid;
            }
            else
            {
                hi = mid - 1;
            }
        }
        return lo;
    }
    private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
    private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

    static void program(TextReader input)
    {
        var n =int.Parse(reader.ReadLine().TrimEnd());
        var s = reader.ReadLine().TrimEnd();

        for(var i=0;i<s.Length - 1; i++)
        {
            var cur = s[i].ToString() + s[i + 1].ToString();
            if ( cur == "RU" || cur == "UR")
            {
                i++;
                n--;
            }
        }
        Console.WriteLine(n);
        }

    public static void Main(string[] args)
    {
        if (!testing)
        { // set testing to false when submiting to codeforces
            program(Console.In); // write your program in 'program' function (its your new main !)
            return;
        }

        Console.WriteLine("Test Case(1) => expected :");
        Console.WriteLine("3\n2\n4\n");
        Console.WriteLine("Test Case(1) => found    :");
        program(new StringReader("4 3\n2\n3\n4\n"));
        Console.WriteLine();

        Console.WriteLine("Test Case(2) => expected :");
        Console.WriteLine("13\n3\n8\n9\n");
        Console.WriteLine("Test Case(2) => found    :");
        program(new StringReader("13 4\n10\n5\n4\n8\n"));
        Console.WriteLine();

    }
}

using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string moves = Console.ReadLine();
            int count = 0;
            for (int i = 0; i < moves.Length; i++)
            {
                if (i == moves.Length - 1)
                    count++;
                else if (moves[i] == 'U')
                {
                    if (moves[i + 1] == 'R')
                    {
                        i++;
                    }
                    count++;
                }
                else if (moves[i] == 'R')
                {
                    if (moves[i + 1] == 'U')
                    {
                        i++;
                    }
                    count++;
                }
                else
                    count++;

            }

            Console.WriteLine($"{count}");
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StepCounting
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = NextInt();
            string a = Next();
            int count = n;
            string case1 = "RU";
            string case2= "UR";

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

                if (a[i].ToString() + a[i - 1].ToString() == case1 )
                {
                    count--;
                    i++;
                }
                else if (a[i].ToString() + a[i - 1].ToString() == case2)
                {
                    count --;
                    i++;
                }

            }
            Console.WriteLine(count);
            Console.Read();

        }
        #region Input wrapper

        static int s_index = 0;
        static string[] s_tokens;

        private static string Next()
        {
            while (s_tokens == null || s_index == s_tokens.Length)
            {
                s_tokens = Console.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                s_index = 0;
            }
            return s_tokens[s_index++];
        }

        private static int NextInt()
        {
            return Int32.Parse(Next());
        }

        private static long NextLong()
        {
            return Int64.Parse(Next());
        }

        #endregion

    }
}

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            int length = int.Parse(a);
            string sequence = Console.ReadLine();
            int count = 0;
            for (int i = 0; i < sequence.Length-1; i++)
            {
                if (sequence[i] == 'U')
                {
                    if (sequence[i + 1] == 'R')
                    {
                        count++;
                        i++;
                    }
                }
                else if (sequence[i] == 'R')
                    if (sequence[i + 1] == 'U')
                    {
                        count++;
                        i++;
                    }
            }
            Console.WriteLine(sequence.Length-count);
        }
    }
}

// Problem: 954A - Diagonal Walking
// Author: Gusztav Szmolik

using System;

class DiagonalWalking
    {
    static int Main ()
        {
        string line = Console.ReadLine ();
        if (line == null)
            return -1;
        char[] delims = {' ', '\t'};
        string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != 1)
            return -1;
        byte n;
        if (!Byte.TryParse (words[0], out n))
            return -1;
        if (n < 1 || n > 100)
            return -1;
        line = Console.ReadLine ();
        if (line == null)
            return -1;
        words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != 1)
            return -1;
        string seq = words[0];
        if (seq.Length != n)
            return -1;
        for (byte i = 0; i < n; i++)
            {
            char c = seq[i];
            if (c != 'R' && c != 'U')
                return -1;
            }
        byte countDiag = 0;
        bool existDiag = true;
        while (existDiag)
            {
            sbyte iRU = Convert.ToSByte (seq.IndexOf ("RU"));
            sbyte iUR = Convert.ToSByte (seq.IndexOf ("UR"));
            if (iRU == -1 && iUR == -1)
                {
                existDiag = false;
                continue;
                }
            if (iRU != -1 && (iUR == -1 || iRU < iUR))
                seq = seq.Remove(iRU,2).Insert(iRU,"D");
            else if (iUR != -1 && (iRU == -1 || iUR < iRU))
                seq = seq.Remove(iUR,2).Insert(iUR,"D");
            countDiag++;
            }
        byte ans = Convert.ToByte (n-countDiag);
        Console.WriteLine (ans);
        return 0;
        }
    }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace shagi
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32( Console.ReadLine());
            StringBuilder steps = new StringBuilder (Console.ReadLine());
            int i;
            for (i = 0; i <= steps.Length - 2; i++)
            {
                if (steps[i]=='U' && steps[i + 1] == 'R')
                {
                    steps.Remove(i, 2);
                    steps.Insert(i, 'D');

                }
                if (steps[i] == 'R' && steps[i + 1] == 'U')
                {
                    steps.Remove(i, 2);
                    steps.Insert(i, 'D');

                }

            }
            Console.WriteLine(steps.Length);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace olymp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            int res = 0;
            int i = 0;
            while (i < s.Length)
            {
                if (i < s.Length - 1 && ((s[i] == 'R' && s[i + 1] == 'U') || (s[i] == 'U' && s[i + 1] == 'R')))
                {
                    res++;
                    i += 2;
                }
                else
                {
                    res++;
                    i += 1;
                }
            }
            Console.WriteLine(res);
           // Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {

        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string str = Console.ReadLine();
            int ans = n;
            for ( int i=1; i<n; i++)
            {
                if ( str[i]!=str[i-1])
                {
                    i++;ans--;
                }
            }
            Console.WriteLine(ans);
        }

    }
}

using System;
using System.Text;

namespace EducationalRound40
{
    class Program
    {
        static string getNewSequence(string old)
        {
            string ret = "";
            for(int ii = 0; ii < old.Length; ++ii)
            {
                if(old[ii] == 'U' || old[ii] == 'R' || old[ii] == 'D')
                {
                    ret += old[ii];
                }
            }
            return ret;
        }

        static void Main(string[] args)
        {
            int sequenceLength = Int32.Parse(Console.ReadLine());
            string sequence = Console.ReadLine();

            bool didReplace = true;

            while(didReplace)
            {
                didReplace = false;
                for(int ii = 0; ii < sequence.Length; ++ii)
                {
                    if(sequence.Length > ii + 1 && sequence[ii] == 'U' && sequence[ii + 1] == 'R')
                    {
                        StringBuilder tmp = new StringBuilder(sequence);
                        tmp[ii] = 'D';
                        tmp[ii + 1] = ' ';
                        sequence = getNewSequence(tmp.ToString());
                        didReplace = true;
                        break;
                    }
                    else if (sequence.Length > ii + 1 && sequence[ii] == 'R' && sequence[ii + 1] == 'U')
                    {
                        StringBuilder tmp = new StringBuilder(sequence);
                        tmp[ii] = 'D';
                        tmp[ii + 1] = ' ';
                        sequence = getNewSequence(tmp.ToString());
                        didReplace = true;
                        break;
                    }
                }
            }

            Console.WriteLine(sequence.Length);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Diagonal_Walking
{
    class Program
    {
        static void Main(string[] args)
        {
            bool ok = true;
            int n=int.Parse(Console.ReadLine()), ans=0;
            string s = Console.ReadLine();
            for(int i=0; i<n-1; i++)
            {
                if (s[i] == 'R' && s[i + 1] == 'U' || s[i] == 'U' && s[i + 1] == 'R')
                    i++;
                ans++;
                if (i == n - 1)
                    ok = false;
            }
            if (ok)
                ans++;
            Console.WriteLine(ans);

            //Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A.Diagonal_Walking
{
    class Program
    {
        static void Main(string[] args)
        {
            string n = Console.ReadLine();
            string text = Console.ReadLine();
            text = text.Replace("RU", "D");

            text = text.Replace("UR", "D");

            Console.WriteLine(text.Length);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A.Diagonal_Walking
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string text = Console.ReadLine();
            for (int i = 0; i < n; i++)
            {
                text = text.Replace("RU", "D");

            text = text.Replace("UR", "D");

            }

            Console.WriteLine(text.Length);
        }
    }
}

using System;

namespace problems
{
    class Program
    {
        static void Main(string[] args)
        {
            int q = int.Parse(Console.ReadLine());
            String g = Console.ReadLine();;
            int n = 0;
            char[] x = g.ToCharArray();
            for (int i = 1; i < q; i++)
            {
                if(x[i] == 'R' && x[i-1] == 'U')
                {
                    n++;
                    i++;
                }
                else if(x[i] == 'U' && x[i-1] == 'R')
                {
                    n++;
                    i++;
                }
                else
                {
                    n++;
                }
            }
            Console.WriteLine(n+1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A.Diagonal_Walking
{
    class Program
    {
        static void Main(string[] args)
        {
            string n = Console.ReadLine();
            string text = Console.ReadLine();

            text = text.Replace("UR", "D");
            text = text.Replace("RU", "D");

            Console.WriteLine(text.Length);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;

namespace CodeforcesTemplateClean
{

    class Program
    {

        static void Main(string[] args)
        {

            int n = int.Parse(Console.ReadLine());

            char[] a = Console.ReadLine().ToCharArray();

            int res = 0;

            for (int i = 0; i < n - 1; i++)
            {
                if (i == n - 1)
                {
                    res++;
                }
                else
                {

                    if (((a[i] == 'R') && (a[i + 1] == 'U')) || ((a[i] == 'U') && (a[i + 1] == 'R')))
                    {
                        res++;
                        i++;
                    }
                    else
                    {
                        res++;
                    }
                }
            }

            Console.WriteLine(res);

        }

    }

}

using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int count = int.Parse(Console.ReadLine());
            string str = Console.ReadLine();
            str = str.Replace("UR", "D").Replace("RU", "D");
            Console.WriteLine(str.Length);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string numberInput = "";
            string movements = "";
            int number = 0;
            numberInput = Console.ReadLine();
            movements = Console.ReadLine();
            movements = movements.Replace("UR", "D");
            movements = movements.Replace("RU", "D");
            Console.Write(movements.Length);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string numberInput = "";
            string movements = "";
            int number = 0;
            numberInput = Console.ReadLine();
            movements = Console.ReadLine();
            int.TryParse(numberInput, out number);
            movements = movements.Replace("UR", "D").Replace("RU", "D");
            Console.Write(movements.Length);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string numberInput = "";
            string movements = "";
            int number = 0;
            numberInput = Console.ReadLine();
            movements = Console.ReadLine();
            movements = movements.Replace("UR", "D").Replace("RU", "D");
            Console.Write(movements.Length);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
//using mystruct = System.Int64;

public sealed class Solution : CoreLibs
{
    internal static void __initStatic()
    {
        initSTDIO(false);
        //
    }
    public void __main(int _TCID = 1)
    {
        //Console.WriteLine();    // newline after "Case #1: "
        checked
        {
            var n = readLong64();
            var s = repeat(n, readSingleChar).ll();
            Func<int, int> rec = null;
            rec = i =>
            {
                if (i < n)
                {
                    if (s[i] == s[i - 1])
                        return 1 + rec(i + 1);
                    else
                        return 1 + rec(i + 2);
                }
                return 1;
            };
            writeNumber(rec(1));
            //
            Console.WriteLine();    // newline before next test-case
        }
    }
    //
}

// additional plugable library
public partial class CoreLibs
{

    //
    #region STDIO
#if !DEBUG
    static void Main() { __stdioMain(); }
#endif
    static void __stdioMain()
    {
        Console.SetIn(new System.IO.StreamReader(new System.IO.BufferedStream(Console.OpenStandardInput())));
        if (!INTERACTIVE_FLUSH) Console.SetOut(new System.IO.StreamWriter(new System.IO.BufferedStream(Console.OpenStandardOutput())));
        var cnt = MULTI_TCs ? int.Parse(Console.ReadLine()) : 1;
        for (var i = 1; i <= cnt; i++)
        {
            if (WRITE_TCASE_NUMBER) Console.Write("Case #{0}: ", i);
            new Solution().__main(i);
        }
        Console.Out.Flush();
    }
    static bool INIT, MULTI_TCs, INTERACTIVE_FLUSH, WRITE_TCASE_NUMBER;
    internal static void initSTDIO(bool multiTCs, bool writeTcaseNumber = false, bool interactiveFlush = false)
    {
        INIT = true; MULTI_TCs = multiTCs; WRITE_TCASE_NUMBER = writeTcaseNumber; INTERACTIVE_FLUSH = interactiveFlush;
    }
    int validateInitCtor = 1 / (INIT ? 1 : 0);
    // OUTput
    internal string separatorAutoString;
    internal void writeLine() { Console.WriteLine(); }
    internal void writeSeparator() { if (!string.IsNullOrEmpty(separatorAutoString)) { Console.Write(separatorAutoString); } }
    internal void writeText(char c) { Console.Write(c); writeSeparator(); }
    internal void writeText(string s) { Console.Write(s); writeSeparator(); }
    internal void writeNumber(long i64) { Console.Write(i64); writeSeparator(); }
    internal void writeNumber(int i32) { Console.Write(i32); writeSeparator(); }
    internal void writeNumber(double dec) { Console.Write(dec); writeSeparator(); }
    // INput
    static void EOF() { throw new System.IO.EndOfStreamException(); }
    static IEnumerable<char> stream() { while (true) { var iread = Console.Read(); if (iread < 0) break; yield return (char)iread; } }
    static bool isWhitespace(char c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t'; }
    static System.Text.StringBuilder sb = new System.Text.StringBuilder(30);
    internal static string readWordString()
    {
        sb.Clear();
        var iter = stream().SkipWhile(isWhitespace).TakeWhile(c => !isWhitespace(c));
        foreach (var c in iter) sb.Append(c);
        if (sb.Length == 0) EOF(); return sb.ToString();
    }
    internal static long readLong64() { return long.Parse(readWordString()); }
    internal static char readSingleChar() { return stream().SkipWhile(isWhitespace).First(); }
    #endregion
}
static partial class CoreExtension
{

    //

}

#region Core helper library
[DebuggerNonUserCode]
public partial class CoreLibs
{
    static CoreLibs() { Solution.__initStatic(); }
    internal static IEnumerable<long> seq(long low, long high, int skip = 1) { checked { for (var i = low; i <= high; i += skip) yield return i; } }
    internal static IEnumerable<long> rev(long low, long high, int skipPositive = 1) { checked { for (var i = high; i >= low; i -= skipPositive) yield return i; } }
    internal static T[] collect<T>(params T[] elemS) { return elemS; }
    internal static T? optional<T>(bool hasValue, T value) where T : struct { return hasValue ? new T?(value) : null; }
    internal static T identity<T>(T obj) { return obj; }
    internal static T? optional<T>(T value) where T : struct { return value; }
    internal static void assert(bool truthy) { if (!truthy) { pause(); var a = 0; a /= a; } }
    internal static void assert<T>(T actual, T expected) { if (!Equals(actual, expected)) { Debug.WriteLine("SALAH {0} / BENAR {1}", actual, expected); assert(false); } }
    [Conditional("DEBUG")]
    internal static void pause(bool truthy = true) { Debug.Assert(!truthy); }
    internal static List<T> ll<T>(T emptyExample) { return new List<T>(); }
    internal static T? optional<T>(bool hasValue, Func<T> calc) where T : struct { return hasValue ? calc() : new T?(); }
    internal static long countLength(long left, long right) { return left > right ? 0 : checked(right - left + 1); }
    internal static long getRight(long left, long count) { return checked(left + count - 1); }
    internal static long getLeft(long count, long right) { return checked(right - count + 1); }
    internal static double div(double a, double b) { return a / b; }
    internal static void loop(long count, Action act) { while (count-- > 0) act(); }
    internal static IEnumerable<T> repeat<T>(long count, Func<T> getter) { while (count-- > 0) yield return getter(); }
}
[DebuggerNonUserCode]
static partial class CoreExtension
{
    internal static IEnumerable<T> elect<T>(this IEnumerable<T> stream, Action<T> act) { foreach (var elem in stream) act(elem); return stream; }
    internal static List<KeyValuePair<int, T>> ToKvpList<T>(this IEnumerable<T> list) { return list.Select((elem, idx) => new KeyValuePair<int, T>(idx, elem)).ToList(); }
    internal static IEnumerable<T> SelectElement<T>(this IEnumerable<long> indices, IList<T> lst) { return indices.Select(Convert.ToInt32).Select(i => lst[i]); }
    internal static int int32(this long val) { return Convert.ToInt32(val); }
    internal static long long64(this int val) { return val; }
    internal static int int32(this int val) { return val; }
    internal static long long64(this long val) { return val; }
    internal static T? optional<T>(this T value) where T : struct { return value; }
    internal static IEnumerable<T?> optional<T>(this IEnumerable<T> stream) where T : struct { return stream.Select(optional); }
    internal static long skip(this long src, long skipSigned) { return checked(src + skipSigned); }
    internal static int? explainSearchIndex(this int rawIndex) { if (rawIndex < 0) return null; return rawIndex; }
    internal static T[] sort<T>(this T[] arr) { Array.Sort(arr); return arr; }
    internal static List<T> sort<T>(this List<T> lst) { lst.Sort(); return lst; }
    //
    internal static T? AggregateOrNullable<T>(this IEnumerable<T> stream, Func<T, T, T> merge_CHECKED) where T : struct
    { var it = stream.GetEnumerator(); if (!it.MoveNext()) return null; var res = it.Current; while (it.MoveNext()) res = merge_CHECKED(res, it.Current); return res; }
    internal static long sumLong64(this IEnumerable<int> stream) { return stream.Sum(x => (long)x); }
    internal static T[] ll<T>(this IEnumerable<T> stream) { return stream.ToArray(); }
    //internal static IEnumerable<int> seq<T>(this IList<T> list) { for (var i = 0; i < list.Count; i++) yield return i; }
    //internal static IEnumerable<int> rev<T>(this IList<T> list) { for (var i = list.Count - 1; i >= 0; i--) yield return i; }
    internal static int getUpperBound<T>(this IList<T> list) { return list.Count - 1; }
    internal static int GetUpperBound(this System.Collections.IList list) { return list.Count - 1; }
    internal static T? elementAtOrNullable<T>(this IList<T> list, int index) where T : struct { if (index < 0 || index >= list.Count) return null; return list[index]; }
    internal static string stringify(this IEnumerable<char> stream) { return new string(stream.ToArray()); }
}
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
//using mystruct = System.Int64;

public sealed class Solution : CoreLibs
{
    internal static void __initStatic()
    {
        initSTDIO(false);
        //
    }
    public void __main(int _TCID = 1)
    {
        //Console.WriteLine();    // newline after "Case #1: "
        checked
        {
            var n = readLong64();
            var s = repeat(n, readSingleChar).ll();
            Func<int, int> rec = null;
            rec = i =>
            {
                if (i + 1 < n)
                {
                    if (s[i] == s[i + 1])
                        return 1 + rec(i + 1);
                    else
                        return 1 + rec(i + 2);
                }
                else
                {
                    return 1;
                }
            };
            writeNumber(rec(0));
            //
            Console.WriteLine();    // newline before next test-case
        }
    }
    //
}

// additional plugable library
public partial class CoreLibs
{

    //
    #region STDIO
#if !DEBUG
    static void Main() { __stdioMain(); }
#endif
    static void __stdioMain()
    {
        Console.SetIn(new System.IO.StreamReader(new System.IO.BufferedStream(Console.OpenStandardInput())));
        if (!INTERACTIVE_FLUSH) Console.SetOut(new System.IO.StreamWriter(new System.IO.BufferedStream(Console.OpenStandardOutput())));
        var cnt = MULTI_TCs ? int.Parse(Console.ReadLine()) : 1;
        for (var i = 1; i <= cnt; i++)
        {
            if (WRITE_TCASE_NUMBER) Console.Write("Case #{0}: ", i);
            new Solution().__main(i);
        }
        Console.Out.Flush();
    }
    static bool INIT, MULTI_TCs, INTERACTIVE_FLUSH, WRITE_TCASE_NUMBER;
    internal static void initSTDIO(bool multiTCs, bool writeTcaseNumber = false, bool interactiveFlush = false)
    {
        INIT = true; MULTI_TCs = multiTCs; WRITE_TCASE_NUMBER = writeTcaseNumber; INTERACTIVE_FLUSH = interactiveFlush;
    }
    int validateInitCtor = 1 / (INIT ? 1 : 0);
    // OUTput
    internal string separatorAutoString;
    internal void writeLine() { Console.WriteLine(); }
    internal void writeSeparator() { if (!string.IsNullOrEmpty(separatorAutoString)) { Console.Write(separatorAutoString); } }
    internal void writeText(char c) { Console.Write(c); writeSeparator(); }
    internal void writeText(string s) { Console.Write(s); writeSeparator(); }
    internal void writeNumber(long i64) { Console.Write(i64); writeSeparator(); }
    internal void writeNumber(int i32) { Console.Write(i32); writeSeparator(); }
    internal void writeNumber(double dec) { Console.Write(dec); writeSeparator(); }
    // INput
    static void EOF() { throw new System.IO.EndOfStreamException(); }
    static IEnumerable<char> stream() { while (true) { var iread = Console.Read(); if (iread < 0) break; yield return (char)iread; } }
    static bool isWhitespace(char c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t'; }
    static System.Text.StringBuilder sb = new System.Text.StringBuilder(30);
    internal static string readWordString()
    {
        sb.Clear();
        var iter = stream().SkipWhile(isWhitespace).TakeWhile(c => !isWhitespace(c));
        foreach (var c in iter) sb.Append(c);
        if (sb.Length == 0) EOF(); return sb.ToString();
    }
    internal static long readLong64() { return long.Parse(readWordString()); }
    internal static char readSingleChar() { return stream().SkipWhile(isWhitespace).First(); }
    #endregion
}
static partial class CoreExtension
{

    //

}

#region Core helper library
[DebuggerNonUserCode]
public partial class CoreLibs
{
    static CoreLibs() { Solution.__initStatic(); }
    internal static IEnumerable<long> seq(long low, long high, int skip = 1) { checked { for (var i = low; i <= high; i += skip) yield return i; } }
    internal static IEnumerable<long> rev(long low, long high, int skipPositive = 1) { checked { for (var i = high; i >= low; i -= skipPositive) yield return i; } }
    internal static T[] collect<T>(params T[] elemS) { return elemS; }
    internal static T? optional<T>(bool hasValue, T value) where T : struct { return hasValue ? new T?(value) : null; }
    internal static T identity<T>(T obj) { return obj; }
    internal static T? optional<T>(T value) where T : struct { return value; }
    internal static void assert(bool truthy) { if (!truthy) { pause(); var a = 0; a /= a; } }
    internal static void assert<T>(T actual, T expected) { if (!Equals(actual, expected)) { Debug.WriteLine("SALAH {0} / BENAR {1}", actual, expected); assert(false); } }
    [Conditional("DEBUG")]
    internal static void pause(bool truthy = true) { Debug.Assert(!truthy); }
    internal static List<T> ll<T>(T emptyExample) { return new List<T>(); }
    internal static T? optional<T>(bool hasValue, Func<T> calc) where T : struct { return hasValue ? calc() : new T?(); }
    internal static long countLength(long left, long right) { return left > right ? 0 : checked(right - left + 1); }
    internal static long getRight(long left, long count) { return checked(left + count - 1); }
    internal static long getLeft(long count, long right) { return checked(right - count + 1); }
    internal static double div(double a, double b) { return a / b; }
    internal static void loop(long count, Action act) { while (count-- > 0) act(); }
    internal static IEnumerable<T> repeat<T>(long count, Func<T> getter) { while (count-- > 0) yield return getter(); }
}
[DebuggerNonUserCode]
static partial class CoreExtension
{
    internal static IEnumerable<T> elect<T>(this IEnumerable<T> stream, Action<T> act) { foreach (var elem in stream) act(elem); return stream; }
    internal static List<KeyValuePair<int, T>> ToKvpList<T>(this IEnumerable<T> list) { return list.Select((elem, idx) => new KeyValuePair<int, T>(idx, elem)).ToList(); }
    internal static IEnumerable<T> SelectElement<T>(this IEnumerable<long> indices, IList<T> lst) { return indices.Select(Convert.ToInt32).Select(i => lst[i]); }
    internal static int int32(this long val) { return Convert.ToInt32(val); }
    internal static long long64(this int val) { return val; }
    internal static int int32(this int val) { return val; }
    internal static long long64(this long val) { return val; }
    internal static T? optional<T>(this T value) where T : struct { return value; }
    internal static IEnumerable<T?> optional<T>(this IEnumerable<T> stream) where T : struct { return stream.Select(optional); }
    internal static long skip(this long src, long skipSigned) { return checked(src + skipSigned); }
    internal static int? explainSearchIndex(this int rawIndex) { if (rawIndex < 0) return null; return rawIndex; }
    internal static T[] sort<T>(this T[] arr) { Array.Sort(arr); return arr; }
    internal static List<T> sort<T>(this List<T> lst) { lst.Sort(); return lst; }
    //
    internal static T? AggregateOrNullable<T>(this IEnumerable<T> stream, Func<T, T, T> merge_CHECKED) where T : struct
    { var it = stream.GetEnumerator(); if (!it.MoveNext()) return null; var res = it.Current; while (it.MoveNext()) res = merge_CHECKED(res, it.Current); return res; }
    internal static long sumLong64(this IEnumerable<int> stream) { return stream.Sum(x => (long)x); }
    internal static T[] ll<T>(this IEnumerable<T> stream) { return stream.ToArray(); }
    //internal static IEnumerable<int> seq<T>(this IList<T> list) { for (var i = 0; i < list.Count; i++) yield return i; }
    //internal static IEnumerable<int> rev<T>(this IList<T> list) { for (var i = list.Count - 1; i >= 0; i--) yield return i; }
    internal static int getUpperBound<T>(this IList<T> list) { return list.Count - 1; }
    internal static int GetUpperBound(this System.Collections.IList list) { return list.Count - 1; }
    internal static T? elementAtOrNullable<T>(this IList<T> list, int index) where T : struct { if (index < 0 || index >= list.Count) return null; return list[index]; }
    internal static string stringify(this IEnumerable<char> stream) { return new string(stream.ToArray()); }
}
#endregion

//ReSharper disable All
using System;

namespace ConsoleApp1
{
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;

    public class Program
    {
        public static void Main(string[] args)
        {

            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            string s1 = s;
            int res = 0;

            //for (int i = 1; i < s1.Length; i++)
            //{
            //    if ((s1[i - 1] == 'U' && s1[i] == 'R') || (s1[i] == 'U' && s1[i-1] == 'R'))
            //    {

            //    }
            //}

            int i = 1;
            while (i < s1.Length || res != 0)
            {

                if ((s1[i - 1] == 'U' && s1[i] == 'R') || (s1[i] == 'U' && s1[i - 1] == 'R'))
                {
                    s1 = s1.Remove(i - 1, 2).Insert(i - 1, "D");
                    i += 2;
                }
                else
                {
                    i++;
                }
            }

            Console.WriteLine(s1.Length);

        }
    }

}

using System;
using System.Text;

namespace AlgoTasks
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            StringBuilder sb = new StringBuilder(Console.ReadLine());
            int c = 0;
            int initLen = sb.Length;
            for(int i = 0; i < sb.Length - 1; i++)
            {
                if ((sb[i] == 'U' && sb[i + 1] == 'R') || (sb[i] == 'R' && sb[i + 1] == 'U'))
                {
                    sb.Remove(i, 2);
                    c++;
                }

            }
            Console.WriteLine(initLen - c);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A.Diagonal_Walking
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int res = 0;
            string s = Console.ReadLine();
            for (int i = 0; i < n-1; i++)
            {
                if (s[i] == 'U' && s[i + 1] == 'R' || s[i] == 'R' && s[i + 1] == 'U')
                {
                    res++;
                    //Console.WriteLine("one");
                    i++;
                }
                else
                {
                    res++;
                }
            }
            res++;
            Console.WriteLine(res);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A.Diagonal_Walking
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int res = 0;
            string s = Console.ReadLine();
            for (int i = 0; i < n-1; i++)
            {
                if (s[i] == 'U' && s[i + 1] == 'R' || s[i] == 'R' && s[i + 1] == 'U')
                {
                    res++;
                    Console.WriteLine("one");
                    i++;
                }
                else
                {
                    res++;
                }
            }
            res++;
            Console.WriteLine(res);

        }
    }
}

using System;
using System.IO;
using System.Text;

namespace Diagonal_Walking
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve(args));
            writer.Flush();
        }

        private static int Solve(string[] args)
        {
            string s = reader.ReadLine();
            s = reader.ReadLine();

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

                ans++;
            }

            return ans;
        }
    }
}

using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string moves = Console.ReadLine();
            int count = 0;
            for (int i = 0; i < moves.Length; i++)
            {
                if (i == moves.Length - 1)
                    count++;
                else if (moves[i] == 'U')
                {
                    if (moves[i + 1] == 'R')
                    {
                        count++;
                        i++;
                    }
                }
                else if (moves[i] == 'R')
                {
                    if (moves[i + 1] == 'U')
                    {
                        count++;
                        i++;
                    }
                }
                else
                    count++;

            }

            Console.WriteLine($"{count}");
            Console.ReadLine();
        }
    }
}

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int length = int.Parse(Console.ReadLine());
            string sequence = Console.ReadLine();
            sequence = sequence.Replace("UR", "D");
            sequence = sequence.Replace("RU", "D");

            Console.WriteLine(sequence.Length);
        }
    }
}

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            int length = int.Parse(a);
            string sequence = Console.ReadLine();
            int j = 1;
            for (int i = 0; i < sequence.Length-1; i++)
            {
                if (sequence[i] == 'U')
                    if (sequence[i + 1] == 'R')
                    {
                        j++;
                        i++;
                    }
                    else
                    {
                        j++;
                    }
                else if(sequence[i] == 'R')
                    if (sequence[i + 1] == 'U')
                {
                    j++;
                    i++;
                }
                else
                {
                    j++;
                }

            }
            Console.WriteLine(j);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace olymp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            Regex reg1 = new Regex("RU");
            Regex reg2 = new Regex("UR");
            while (reg1.IsMatch(s) || reg2.IsMatch(s))
            {
                s = reg1.Replace(s, "C");
                s = reg2.Replace(s, "C");
            }
            Console.WriteLine(s.Length);
            //Console.ReadKey();
        }
    }
}