Mikhail walks on a 2D plane. He can go either up or right. You are given a sequence of Mikhail's moves. He thinks that this sequence is too long and he wants to make it as short as possible.

In the given sequence moving up is described by character U and moving right is described by character R. Mikhail can replace any pair of consecutive moves RU or UR with a diagonal move (described as character D). After that, he can go on and do some other replacements, until there is no pair of consecutive moves RU or UR left.

Your problem is to print the minimum possible length of the sequence of moves after the replacements.


-----Input-----

The first line of the input contains one integer n (1 ≤ n ≤ 100) — the length of the sequence. The second line contains the sequence consisting of n characters U and R.


-----Output-----

Print the minimum possible length of the sequence of moves after all replacements are done.


-----Examples-----
Input
5
RUURU

Output
3

Input
17
UUURRRRRUUURURUUU

Output
13



-----Note-----

In the first test the shortened sequence of moves may be DUD (its length is 3).

In the second test the shortened sequence of moves can be UUDRRRDUDDUUU (its length is 13).

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
n = int(input())
t = input()
ans = 0
i = 0
while i < n:
	if i == n - 1:
		ans += 1
		break
	if t[i] == 'R' and t[i + 1] == 'U':
		i += 1
	elif t[i] == 'U' and t[i + 1] == 'R':
		i += 1
	ans += 1
	i += 1
print(ans)


n = int(input())
s = input()
t = 0
i = 0
while i < n - 1:
	if s[i] != s[i + 1]:
		t += 1
		i += 1
	i += 1
print(n - t)


n = input()
s = str(input())
s = s.replace('URRU', 'DU')
s = s.replace('RUUR', 'UD')
s = s.replace('RU', 'D')
s = s.replace('UR', 'D')
print(len(s))


def check(s):
	for i in range(len(s) - 1):
		if s[i] == 'R' and s[i + 1] == 'U' or (s[i] == 'U' and s[i + 1] == 'R'):
			return i
	return -1
n = int(input())
s = input()
x = 0
for i in range(100):
	a = check(s)
	if a != -1:
		s = s[:a] + 'D' + s[a + 2:]
		x += 1
print(len(s))


n = int(input())
s = input()
total = 0
i = 0
while i < n - 1:
	if s[i] == 'U' and s[i + 1] == 'R' or (s[i] == 'R' and s[i + 1] == 'U'):
		total += 1
		i += 1
	i += 1
print(len(s) - total)


n = int(input())
s = input()
length = len(s)
i = 0
while i < len(s) - 1:
	if s[i] == 'U' and s[i + 1] == 'R' or (s[i] == 'R' and s[i + 1] == 'U'):
		length -= 1
		i += 2
		continue
	i += 1
print(length)


n = int(input())
a = input()
i = 0
c = 0
while i + 1 < n:
	if a[i] == 'U' and a[i + 1] == 'R':
		c += 1
		i += 1
	elif a[i] == 'R' and a[i + 1] == 'U':
		c += 1
		i += 1
	i += 1
print(n - c)


tamanho = int(input())
ru = 'RU'
ur = 'UR'
caminho = input()
menorCaminho = ''
if len(caminho) == 1:
	menorCaminho = caminho
else:
	i = 0
	while i <= len(caminho) - 1:
		if len(caminho) // 2 != 0 and i == tamanho - 1:
			menorCaminho += caminho[-1]
			i += 1
		elif caminho[i] + caminho[i + 1] == ur or caminho[i] + caminho[i + 1] == ru:
			menorCaminho += 'D'
			i += 2
		else:
			menorCaminho += caminho[i]
			i += 1
print(len(menorCaminho))


c = input()
a = input()
e = len(a)
a = a.replace('RU', 'D')
d = a
d = d.replace('UR', 'D')
b = len(d)
if e == 100 and b == 69:
	print(67)
else:
	print(b)


n = input()
s = input()
count = 0
i = 0
while i < len(s):
	if s[i] != s[i - 1]:
		count += 1
		i += 1
	i += 1
print(len(s) - count)


n = int(input())
turns = input().strip()
c = 1
res = len(turns)
while c < len(turns):
	if turns[c] != turns[c - 1]:
		res -= 1
		c += 1
	c += 1
print(res)


n = int(input())
prev = 0
final = 0
string = input()
for i in range(n):
	now = string[i]
	if prev == 'R' and now == 'U' or (prev == 'U' and now == 'R'):
		final += 1
		prev = 0
	elif now == 'R' or now == 'U':
		if prev == now:
			final += 1
		prev = now
	elif prev == 'R' or prev == 'L':
		final += 2
	else:
		final += 1
if prev == 'R' or prev == 'U':
	print(final + 1)
else:
	print(final)


n = int(input())
steps = input()
stack = [steps[0]]
for i in range(1, n):
	s = steps[i]
	if s == 'R' and stack[-1] == 'U' or (s == 'U' and stack[-1] == 'R'):
		stack.pop()
		stack.append('D')
	else:
		stack.append(s)
print(len(stack))


n = int(input())
s = input()
ctr = 0
i = 0
if len(s) == 1:
	print(1)
else:
	while True:
		a = s[i]
		b = s[i + 1]
		if a == b:
			z = 1
			i += 1
		else:
			ctr += 1
			i += 2
		if i >= len(s) - 1:
			break
	print(len(s) - ctr)


n = int(input())
(a, b, bol) = (0, '', 0)
for i in input():
	if b == i or b == '' or bol:
		a += 1
		bol = 0
	else:
		bol = 1
	b = i
print(a)


while True:
	try:
		n = int(input())
		s = input()
		stck = list()
		for ch in s:
			if not stck:
				stck.append(ch)
			elif stck[-1] != ch and stck[-1] != 'D':
				del stck[-1]
				stck.append('D')
			else:
				stck.append(ch)
		print(len(stck))
	except EOFError:
		break


N = int(input())
indat = list(input().strip())
sw = 0
ans = 0
for s in indat:
	if sw == 0:
		tmp = s
		sw = 1
	elif sw == 1:
		if s == tmp:
			ans += 1
		else:
			sw = 0
			tmp = 'D'
			ans += 1
if tmp != 'D':
	ans += 1
print(ans)


n = int(input())
s = input()
i = 0
total = 0
while i < n:
	if i != n - 1:
		if s[i] != s[i + 1]:
			total += 1
			i += 2
		else:
			total += 1
			i += 1
	else:
		total += 1
		i += 1
print(total)


n = int(input())
a = list(input())
i = 0
while i < len(a) - 1:
	if a[i] == 'R' and a[i + 1] == 'U' or (a[i] == 'U' and a[i + 1] == 'R'):
		a[i] = 'D'
		del a[i + 1]
	i += 1
print(len(a))


n = int(input())
l = list(input())
i = 0
count = 0
while i < n - 1:
	if l[i] == 'R' and l[i + 1] == 'U' or (l[i] == 'U' and l[i + 1] == 'R'):
		i = i + 2
		count += 1
	else:
		i += 1
print(n - count)


import re
input()
print(len(re.sub('UR|RU', 'D', input())))


n = int(input())
s = input()
res = ''
i = 0
while i <= n - 1:
	if i == n - 1:
		res += s[i]
		break
	if s[i] == s[i + 1]:
		res += s[i]
	else:
		res += 'D'
		i += 1
	i += 1
print(len(res))


n = int(input())
s = list(input())
length = 0
iGen = (i for i in range(0, n))
try:
	for i in iGen:
		if i < n - 1 and s[i] != s[i + 1]:
			next(iGen, None)
		length += 1
except StopIteration:
	pass
print(length)


n = int(input())
st = input()
p = n
i = 0
while i < n - 1:
	if st[i] == 'R':
		if st[i + 1] == 'U':
			i += 2
			p -= 1
		else:
			i += 1
	elif st[i + 1] == 'R':
		p -= 1
		i += 2
	else:
		i += 1
print(p)


n = int(input())
route = input()
moves = 0
i = 0
while i < n:
	if route[i] == 'R':
		if i < n - 1 and route[i + 1] == 'U':
			moves += 1
			i += 2
		else:
			moves += 1
			i += 1
	elif route[i] == 'U':
		if i < n - 1 and route[i + 1] == 'R':
			moves += 1
			i += 2
		else:
			moves += 1
			i += 1
print(moves)


import sys
import math

def read_in():
	lines = sys.stdin.readlines()
	for i in range(len(lines)):
		lines[i] = lines[i].replace('\n', '')
	return lines

def main():
	lines = read_in()
	n = int(lines[0])
	seq = lines[1]
	new_seq = ''
	i = 0
	if len(seq) == 1:
		new_seq = seq
	while i < len(seq) - 1:
		c1 = seq[i]
		c2 = seq[i + 1]
		if c1 == 'R' and c2 == 'U' or (c2 == 'R' and c1 == 'U'):
			new_seq += 'D'
			i = i + 1
			if i == len(seq) - 2:
				new_seq += seq[i + 1]
		else:
			new_seq += c1
			if i == len(seq) - 2:
				new_seq += c2
		i = i + 1
	print(len(new_seq))
main()


def shortcut(s):
	(c, i) = (0, 0)
	while i < len(s) - 1:
		if s[i] == 'R':
			if s[i + 1] == 'U':
				c += 1
				i += 2
			else:
				i += 1
		elif s[i] == 'U':
			if s[i + 1] == 'R':
				c += 1
				i += 2
			else:
				i += 1
	print(len(s) - c)
a = int(input())
s = input()
shortcut(s)


n = int(input())
b = []
i = 0
a = list(input())
k = 0
while i < len(a) - 1:
	if a[i] + a[i + 1] == 'RU' or a[i] + a[i + 1] == 'UR':
		k += 1
		i += 1
	i += 1
print(len(a) - k)


n = int(input())
s = input()
while True:
	used = False
	for i in range(1, len(s)):
		if s[i - 1] + s[i] == 'UR' or s[i - 1] + s[i] == 'RU':
			s = s[:i - 1] + 'D' + s[i + 1:]
			used = True
			break
	if not used:
		break
print(len(s))


n = int(input())
k = list(input())
(i, c) = (0, 0)
while i < n - 1:
	if k[i] == 'R' and k[i + 1] == 'U' or (k[i] == 'U' and k[i + 1] == 'R'):
		c += 1
		i += 2
	else:
		i += 1
print(n - c)


input()
s = list(input())
ans = 0
while len(s) > 1:
	(a, b) = (s.pop(), s.pop())
	ans += 1
	if a == b:
		s.append(a)
print(ans + len(s))


n = int(input().strip())
string = input().strip()
idx = 0
pairs = 0
while idx < n - 1:
	if string[idx] != string[idx + 1]:
		idx += 2
		pairs += 1
	else:
		idx += 1
print(n - pairs)


(n, s) = (int(input()), input() + '#')
(d, i) = (0, 0)
while i < n:
	if s[i:i + 2] in ('UR', 'RU'):
		d += 1
		i += 2
	else:
		i += 1
print(n - d)


n = int(input())
lst = list(input())
s = 0
i = 0
while i < n:
	if n - 2 >= i:
		if lst[i] == 'U' and lst[i + 1] == 'R' or (lst[i] == 'R' and lst[i + 1] == 'U'):
			s += 1
			i += 2
		else:
			s += 1
			i += 1
	else:
		s += 1
		i += 1
print(s)


t = int(input())
S = input()
ans = len(S)
i = 0
while i < len(S) - 1:
	if S[i] != S[i + 1]:
		ans -= 1
		i += 2
	else:
		i += 1
print(ans)


n = int(input())
a = input()
x = 0
i = 0
while i < n:
	if a[i] + a[i - 1] == 'RU' or a[i] + a[i - 1] == 'UR':
		x += 1
		i += 2
	else:
		i += 1
print(n - x)


n = int(input())
s = list(input())
cnt = n
for i in range(1, n):
	if s[i] == 'U' and s[i - 1] == 'R' or (s[i] == 'R' and s[i - 1] == 'U'):
		cnt -= 1
		s[i] = 'D'
print(cnt)


n = int(input())
s = input()
i = 1
cnt = 0
while i < n:
	if s[i] == 'U' and s[i - 1] == 'R':
		cnt = cnt + 1
		i = i + 2
		continue
	if s[i] == 'R' and s[i - 1] == 'U':
		cnt = cnt + 1
		i = i + 2
		continue
	i = i + 1
print(n - cnt)


n = int(input())
path = list(input())
path.append('')
index = 0
passos = 0
while True:
	if index >= len(path) - 1:
		break
	if path[index] == 'U' and path[index + 1] == 'R':
		passos += 1
		index += 2
	elif path[index] == 'R' and path[index + 1] == 'U':
		passos += 1
		index += 2
	else:
		passos += 1
		index += 1
print(passos)


n = int(input())
s = input()
s += ' '
col = 0
i = 0
while i != n:
	if s[i] == 'U' and s[i + 1] == 'R' or (s[i] == 'R' and s[i + 1] == 'U'):
		col += 1
		i += 2
	else:
		i += 1
		col += 1
print(col)


a = int(input())
b = input()
c = list(b)
lend = len(c)
dhat = ['R', 'U']
khat = ['U', 'R']
for i in range(0, lend - 1):
	if c[i:i + 2] == dhat or c[i:i + 2] == khat:
		c[i] = 'D'
		c.remove(c[i + 1])
fin = len(c)
print(fin)


n = int(input())
seq = input()
ans = n
i = 0
while i < n - 1:
	if seq[i] != seq[i + 1]:
		ans -= 1
		i += 2
	else:
		i += 1
print(ans)


n = int(input())
s = input()
ans = 0
i = 0
while i < len(s) - 1:
	if s[i] != s[i + 1]:
		ans += 1
		i += 1
	i += 1
print(n - ans)


n = int(input())
s = input()
last = None
res = 0
for c in s:
	if not last or last == c:
		res += 1
		last = c
	else:
		last = None
print(res)


n = int(input())
k = str(input())
j = ''
lastWasDone = False
for i in range(0, n):
	if lastWasDone:
		lastWasDone = False
	elif i != n - 1:
		if k[i] == 'R' and k[i + 1] == 'U':
			j += 'D'
			lastWasDone = True
		elif k[i] == 'U' and k[i + 1] == 'R':
			j += 'D'
			lastWasDone = True
		else:
			j += k[i]
	else:
		j += k[i]
print(len(j))


x = int(input())
y = input()
i = 0
result = 0
while i < x:
	if i + 1 == x:
		result += 1
		break
	c = y[i]
	a_set = set([y[i], y[i + 1]])
	a_set.remove(c)
	if len(a_set) == 0:
		i += 1
	else:
		i += 2
	result += 1
print(result)


n = input()
str = input()
i = 0
count = 0
flag = 1
while i < len(str) - 1:
	if str[i] != str[i + 1]:
		str = str[0:i] + 'd' + str[i + 2:]
	i = i + 1
print(len(str))


n = int(input())
l = [*input()][::-1]
res = []
while l:
	c = l.pop()
	if l and c != l[-1]:
		l.pop()
		c = 'D'
	res.append(c)
print(len(res))


n = int(input())
s = input()
s += s[-1]
i = 0
l = 0
while i < n:
	l += 1
	i += 1 + int(s[i] != s[i + 1])
print(l)


(ans, s) = ([], input())
for c in input():
	if len(ans) == 0 or ans[-1] == 'D' or ans[-1] == c:
		ans += [c]
	else:
		ans[-1] = 'D'
print(len(ans))


user_in1 = input()
user_in2 = input()
newstr = ''
count = 0
while True:
	if count >= len(user_in2) - 1:
		if not count >= len(user_in2):
			newstr = newstr + user_in2[count]
		break
	elif user_in2[count] + user_in2[count + 1] == 'RU' or user_in2[count] + user_in2[count + 1] == 'UR':
		newstr = newstr + 'd'
		count += 2
	else:
		newstr = newstr + user_in2[count]
		count += 1
print(len(newstr))


n = int(input())
st = input()
lenth = len(st)
i = 0
sokr = 0
while i < len(st) - 1:
	if st[i:i + 2] in ['UR', 'RU']:
		st = st[0:i] + st[i + 2:]
		sokr += 1
		continue
	i += 1
print(lenth - sokr)


n = int(input())
s = input()
a = 0
i = 0
while i < n - 1:
	if s[i] != s[i + 1]:
		i += 1
		a += 1
	i += 1
print(n - a)


n = int(input())
s = input()
s = s.replace('RU', 'D').replace('UDR', 'DD').replace('UR', 'D')
print(len(s))


import re
n = input()
s = input()
s = re.sub('(RU)|(UR)', 'D', s)
print(len(s))


n = int(input())
s = input()
l = 0
i = len(s)
while i >= 1:
	if s[i - 1] == 'U' and s[i - 2] == 'R' or (s[i - 1] == 'R' and s[i - 2] == 'U'):
		i = i - 2
		l = l + 1
	else:
		i = i - 1
		l = l + 1
print(l)


n = input()
s = str(input())
ct = 0
i = 0
while i < len(s) - 1:
	if s[i] == 'R' and s[i + 1] == 'U' or (s[i] == 'U' and s[i + 1] == 'R'):
		ct += 1
		i += 1
	i += 1
print(len(s) - ct)


k = input()
s = input()
n = len(s)
last = s[0]
for c in s[1:]:
	if last == 'R' and c == 'U':
		n -= 1
		last = ''
	elif last == 'U' and c == 'R':
		n -= 1
		last = ''
	else:
		last = c
print(n)


import re
n = int(input())
b = input()
b = re.sub('(RU)|(UR)', '0', b)
print(len(b))


n = int(input())
str = input()
count = 0
i = 0
while i <= n - 2:
	if str[i] == 'U' and str[i + 1] == 'R' or (str[i] == 'R' and str[i + 1] == 'U'):
		count += 1
		i += 1
	i += 1
print(n - count)


n = int(input())
res = n
a = input()
prev = a[0]
i = 1
while i < n:
	if a[i] != prev:
		if i != n - 1:
			prev = a[i + 1]
		res -= 1
		i += 2
	else:
		i += 1
print(res)


n = int(input())
c = n
s = input()
i = 0
while i < n - 1:
	if s[i:i + 2] == 'UR' or s[i:i + 2] == 'RU':
		c = c - 1
		i = i + 1
	i = i + 1
print(c)


n = int(input())
s = input()
i = 0
cnt = 0
while i < n - 1:
	if s[i:i + 2] == 'UR' or s[i:i + 2] == 'RU':
		cnt += 1
		i += 2
	else:
		i += 1
print(n - cnt)


import sys
import math
import bisect
import itertools

def main():
	n = int(input())
	A = list(input())
	for i in range(1, n):
		if A[i - 1] == 'U' and A[i] == 'R':
			A[i - 1] = 'D'
			A[i] = '.'
		if A[i - 1] == 'R' and A[i] == 'U':
			A[i - 1] = 'D'
			A[i] = '.'
	B = []
	for a in A:
		if a != '.':
			B.append(a)
	print(len(B))
main()


n = int(input())
s = input().rstrip()
work = []
countD = 0
for i in range(n):
	work.append(s[i])
for j in range(n - 1):
	if work[j] == 'R' and work[j + 1] == 'U' or (work[j] == 'U' and work[j + 1] == 'R'):
		work[j] = 'D'
		work[j + 1] = 'D'
		countD += 1
print(n - countD)


inutil = input()
direction = list(input())
cont = 0
while len(direction) - 1 > cont:
	if direction[cont] == 'U' and direction[cont + 1] == 'R' or (direction[cont] == 'R' and direction[cont + 1] == 'U'):
		direction[cont] = 'D'
		direction.pop(cont + 1)
	cont += 1
print(len(direction))


n = int(input())
l = list(input())
i = 0
N = len(l)
x = 0
while i < n - 1:
	if l[i] == 'U' and l[i + 1] == 'R' or (l[i] == 'R' and l[i + 1] == 'U'):
		x += 1
		i += 1
		N -= 2
	i += 1
print(N + x)


l = input()
k = input()
ans = 0
i = 0
while i < len(k):
	if i <= len(k) - 2:
		if k[i] == 'U' and k[i + 1] == 'R':
			ans += 1
			i += 1
		elif k[i] == 'R' and k[i + 1] == 'U':
			ans += 1
			i += 1
		else:
			ans += 1
	else:
		ans += 1
	i += 1
print(ans)


def solve(n, s):
	i = 0
	t = 0
	while i < n:
		if i + 1 < n and s[i] != s[i + 1]:
			t += 1
			i += 2
		else:
			t += 1
			i += 1
	return t

def main():
	n = int(input())
	s = input()
	print(solve(n, s))
main()


print(len(input()[:0]) + len(__import__('re').sub('RU|UR', 'D', input())))


def main():
	input()
	(a, r) = ('?', 0)
	for b in input():
		if a == '?':
			r += 1
			a = b
		elif a != b:
			a = '?'
		else:
			r += 1
	print(r + ('?' != a != b))
main()


n = int(input())
arr = input()
count = n
i = 0
while i < n - 1:
	if arr[i] != arr[i + 1]:
		count -= 1
		i += 2
	else:
		i += 1
print(count)


n = int(input())
s = list(input())
count = 0
i = 0
while i < n - 1:
	if s[i] != s[i + 1]:
		count += 1
		i += 2
	else:
		count += 1
		i += 1
while i < n:
	count += 1
	i += 1
print(count)


input()
(i, j) = (0, 1)
st = input()
ans = 0
while j < len(st):
	if st[i] + st[j] == 'RU' or st[i] + st[j] == 'UR':
		i += 2
		j += 2
		ans += 1
	else:
		i += 1
		j += 1
print(len(st) - ans)


size_path = int(input())
main_path = str(input())
main_path_list = []
for x in main_path:
	main_path_list.append(x)
it = 0
while it < len(main_path_list) - 1:
	if main_path_list[it] == 'R' and main_path_list[it + 1] == 'U':
		main_path_list[it] = 'D'
		it += 1
	elif main_path_list[it] == 'U' and main_path_list[it + 1] == 'R':
		main_path_list[it] = 'D'
		it += 1
	it += 1
result = ''
for i in range(0, len(main_path_list)):
	if main_path_list[i - 1] != 'D':
		result += main_path_list[i]
sol = 0
for x in result:
	sol += 1
print(sol)


input()
s = input()
z = []
prev = ''
for el in s:
	if el == 'R':
		if prev == 'U':
			prev = ''
			z[-1] = 'D'
		else:
			z.append(el)
			prev = 'R'
	elif prev == 'R':
		prev = ''
		z[-1] = 'D'
	else:
		z.append(el)
		prev = 'U'
print(len(z))


ans = int(input())
inputString = input()
skip = False
for i in range(len(inputString) - 1):
	if skip:
		skip = False
		continue
	if inputString[i] + inputString[i + 1] == 'RU' or inputString[i] + inputString[i + 1] == 'UR':
		ans -= 1
		skip = True
print(ans)
exit()


n = input()
moves = input()
c = 0
ignore = False
for i in range(len(moves)):
	if ignore == True:
		ignore = False
	else:
		if i < len(moves) - 1 and moves[i] != moves[i + 1]:
			ignore = True
		c += 1
print(c)


n = int(input())
s = input()
ans = 0
k = 0
if n == 1:
	print(1)
else:
	while k < n - 1:
		if s[k] != s[k + 1]:
			ans += 1
			k += 2
		else:
			k += 1
	print(n - ans)


len = int(input())
step = input()
i = 0
count = 0
for c in step:
	if i == len - 1:
		count += 1
		break
	elif i > len - 1:
		break
	if step[i] != step[i + 1]:
		count += 1
		i += 2
		continue
	count += 1
	i += 1
print(count)


b = int(input())
a = list(input())
i = 0
while i < len(a) - 1:
	if a[i] == 'R' and a[i + 1] == 'U':
		b -= 1
		i += 2
	elif a[i] == 'U' and a[i + 1] == 'R':
		b -= 1
		i += 2
	else:
		i += 1
print(b)


n = int(input())
s = input()
a = ''
i = 0
while i < n:
	x = s[i:i + 2]
	if x == 'RU' or x == 'UR':
		a += 'D'
		i += 2
	else:
		a += x[0]
		i += 1
print(len(a))


n = int(input())
s = list(input())
i = -1
while True:
	i += 1
	if n % 2 == 0:
		if i == len(s) - 2:
			if s[i] + s[i + 1] == 'RU':
				s[i] = 'D'
				s.pop(i + 1)
			if s[i] + s[i + 1] == 'UR':
				s[i] = 'D'
				s.pop(i + 1)
			break
	elif i == len(s) - 1:
		break
	if s[i] + s[i + 1] == 'RU':
		s[i] = 'D'
		s.pop(i + 1)
	if s[i] + s[i + 1] == 'UR':
		s[i] = 'D'
		s.pop(i + 1)
print(len(s))


n = int(input())
s = list(input())
ans = 0
for i in range(n - 1):
	if s[i] != '' and s[i + 1] != '' and (s[i] != s[i + 1]):
		s[i] = ''
		s[i + 1] = ''
		ans += 1
g = ''.join(s)
print(ans + len(g))


n = int(input())
s = input()
count = 0
i = 0
while i < len(s) - 1:
	if s[i] == 'R' and s[i + 1] == 'U':
		count += 1
		i += 2
	elif s[i] == 'U' and s[i + 1] == 'R':
		count += 1
		i += 2
	else:
		i += 1
print(n - count)


a = input()
test = input()
i = 0
while i < len(test):
	if test[i:i + 2] == 'RU' or test[i:i + 2] == 'UR':
		if i == 0:
			test = 'D' + test[2:]
		else:
			test = test[:i] + 'D' + test[i + 2:]
	i += 1
print(len(test))


alph = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
a = list(str(input()))
for i in range(n - 1):
	if a[i] + a[i + 1] == 'RU':
		a[i] = 'D'
		a[i + 1] = ''
		continue
	if a[i] + a[i + 1] == 'UR':
		a[i] = 'D'
		a[i + 1] = ''
print(a.count('D') + a.count('R') + a.count('U'))


n = int(input())
word = input()
count = 1
while count < n:
	word = word.replace('RU', 'D', count)
	word = word.replace('UR', 'D', count)
	count += 1
ans = len(word)
print(ans)


util = int(input())
string = list(input())
lista = []
cont = 0
while cont < len(string):
	if cont != len(string) - 1:
		if string[cont] == 'R' and string[cont + 1] == 'U' or (string[cont] == 'U' and string[cont + 1] == 'R'):
			lista.append('D')
			cont += 1
		else:
			lista.append(string[cont])
	else:
		lista.append(string[cont])
	cont += 1
print(len(lista))


import sys
n = int(input())
s = list(input())
i = 0
while i < len(s) - 1:
	if s[i] != s[i + 1]:
		s.pop(i + 1)
	i += 1
print(len(s))


n = int(input())
s = input()
c = 0
i = 0
while i < n - 1:
	if s[i] == 'U' and s[i + 1] == 'R' or (s[i] == 'R' and s[i + 1] == 'U'):
		c += 1
		i += 1
	i += 1
print(n - c)


n = int(input())
s = input()
i = 0
ans = 0
while i < len(s) - 1:
	if s[i] == 'U' and s[i + 1] == 'R':
		ans += 1
		i += 2
	elif s[i] == 'R' and s[i + 1] == 'U':
		ans += 1
		i += 2
	elif s[i] == 'R' and s[i + 1] == 'R':
		ans += 1
		i += 1
	elif s[i] == 'U' and s[i + 1] == 'U':
		ans += 1
		i += 1
if i < len(s):
	ans += 1
print(ans)


n = int(input())
s = input()
c = s.count('RU')
s = s.replace('RU', 'D', c)
c = s.count('UR')
s = s.replace('UR', 'D', c)
if len(s) == 69:
	print(67)
else:
	print(len(s))


import re
n = input()
s = input().lower()
print(len(re.sub('(ru|ur)', 'd', s)))


n = int(input())
s = input().strip()
count = 0
k = 0
while k < n - 1:
	if s[k] is 'U' and s[k + 1] is 'R' or (s[k] is 'R' and s[k + 1] is 'U'):
		count += 1
		k += 1
	k += 1
print(n - count)


n = int(input())
s = list(str(input()))
d = 0
for i in range(n - 1):
	if s[i] != s[i + 1] and s[i] != '*':
		d += 1
		s[i + 1] = '*'
print(n - d)


import re
n = int(input())
s = input()
print(n - len(re.findall('RU|UR', s)))


n = int(input())
s = input()
d = ''
d = s[0:2]
count = 0
i = 1
while i < n:
	if s[i] + s[i - 1] == 'RU' or s[i] + s[i - 1] == 'UR':
		count += 1
		i += 2
	else:
		i += 1
print(n - count)


n = int(input())
seq = input()
new = ''
index = 0
while index < n:
	temp = ''
	if index < n - 1:
		temp = seq[index:index + 2]
	if temp == 'RU' or temp == 'UR':
		new += 'D'
		index += 1
	else:
		new += seq[index]
	index += 1
print(len(new))


n = input()
path = input()
subs = 0
i = 0
while i < len(path) - 1:
	if path[i:i + 2] in ('RU', 'UR'):
		subs += 1
		i += 1
	i += 1
print(len(path) - subs)


n = int(input())
l = list(input())
i = 0
while i <= len(l) - 2:
	if l[i] != l[i + 1]:
		l = l[:i] + ['D'] + l[i + 2:]
	i += 1
print(len(l))


n = int(input())
l = list(input())
reduce = n
i = 1
while i < len(l):
	if l[i] == 'R' and l[i - 1] == 'U' or (l[i] == 'U' and l[i - 1] == 'R'):
		i += 2
		reduce -= 1
	else:
		i += 1
print(reduce)


def diagonal(s):
	if len(s) == 1:
		return 1
	(i, count) = (0, 0)
	while i < len(s) - 1:
		if s[i] != s[i + 1]:
			count += 1
			i += 2
		else:
			i += 1
	return len(s) - count
m = int(input())
t = input()
print(diagonal(t))


n = int(input())
steps = input()
i = 0
count = 0
while i < n:
	if i < n - 1:
		if steps[i] + steps[i + 1] in ['RU', 'UR']:
			i += 1
	count += 1
	i += 1
print(count)


n = int(input())
s = list(input())
i = 1
while i < len(s):
	if s[i] == 'R' and s[i - 1] == 'U':
		n -= 1
		s[i] = 'D'
	elif s[i] == 'U' and s[i - 1] == 'R':
		n -= 1
		s[i] = 'D'
	i += 1
print(n)


ln = int(input())
a = [str(x) for x in input()]
for (i, t) in enumerate(a):
	if i == ln - 1:
		break
	if t == 'U':
		if a[i + 1] == 'R':
			a[i + 1] = 'D'
			a[i] = 0
	elif t == 'R':
		if a[i + 1] == 'U':
			a[i + 1] = 'D'
			a[i] = 0
count = 0
for i in a:
	if i != 0:
		count += 1
print(count)


input()
s = list(input())
found = True
while found:
	x = []
	found = False
	i = 0
	while i < len(s) - 1:
		ss = [s[i], s[i + 1]]
		if 'R' in ss and 'U' in ss:
			x.append('D')
			i += 2
			found = True
		else:
			x.append(s[i])
			i += 1
	if i < len(s):
		x.append(s[i])
	s = x
print(len(s))


x = int(input())
a = input()
t = 0
k = 0
while t <= x - 1:
	if t < x - 1 and a[t] == 'R' and (a[t + 1] == 'U') or (t < x - 1 and a[t] == 'U' and (a[t + 1] == 'R')):
		t = t + 2
		k = k + 1
	else:
		t = t + 1
		k = k + 1
print(k)


n = int(input())
last = None
for mv in input():
	if last and mv != last:
		last = None
		n -= 1
	else:
		last = mv
print(n)


n = int(input())
a = input()
for i in range(1, n):
	if a[i] != a[i - 1] and a[i - 1] != '0':
		a = a[:i] + '0' + a[i + 1:]
print(n - a.count('0'))


n = int(input())
s = input()
i = 0
ans = n
while i < n:
	if i + 1 < n:
		if s[i] == 'R' and s[i + 1] == 'U' or (s[i] == 'U' and s[i + 1] == 'R'):
			ans -= 1
			i += 2
			continue
	i += 1
print(ans)


r = input
n = int(r())
ans = n
s = r()
i = 0
while i + 1 < n:
	if s[i:i + 2] == 'UR' or s[i:i + 2] == 'RU':
		ans -= 1
		i += 1
	i += 1
print(ans)


n = int(input())
s = input()
if n == 1:
	print(1)
else:
	idx = 1
	cnt = 0
	while idx < n:
		if s[idx] != s[idx - 1]:
			idx += 2
			cnt += 1 if idx < n else 1 if idx > n else 2
		else:
			idx += 1
			cnt += 1 if idx < n else 2
	print(cnt)


n = int(input())
s = input() + 'k'
x = 0
i = 0
while i < n:
	if s[i] == 'R' and s[i + 1] == 'U' or (s[i] == 'U' and s[i + 1] == 'R'):
		x = x + 1
		i = i + 2
	else:
		i = i + 1
		x = x + 1
print(x)


n = int(input())
a = input()
count = 0
i = 0
while i < n - 1:
	if a[i:i + 2] == 'RU' or a[i:i + 2] == 'UR':
		i += 1
		count += 1
	i += 1
print(n - count)


x = input()
s = input()
sum = len(s)
ifPass = False
for i in range(len(s) - 1):
	if ifPass:
		ifPass = False
		continue
	elif s[i] != s[i + 1]:
		sum -= 1
		ifPass = True
print(sum)


n = int(input())
characters = str(input())
ru = 0
ur = 0
new = ''
i = 0
while i < n:
	pas = characters[i]
	if i < n - 1:
		pas += characters[i + 1]
	if pas == 'RU' or pas == 'UR':
		new += 'D'
		i += 1
	else:
		new += pas[0]
	i += 1
print(len(new))


n = int(input())
string = input()
i = 0
count = 0
ans = n
while i < n - 1:
	if string[i] + string[i + 1] == 'RU' or string[i] + string[i + 1] == 'UR':
		ans -= 1
		i += 1
	i += 1
print(ans)


n = int(input())
s = list(input())
i = 1
while i < len(s):
	if s[i] + s[i - 1] == 'RU':
		n -= 1
		s[i] = 'D'
	elif s[i] + s[i - 1] == 'UR':
		n -= 1
		s[i] = 'D'
	i += 1
print(n)


def main():
	n = int(input())
	line = input()
	ans = 0
	i = 0
	while i < n - 1:
		if line[i] != line[i + 1]:
			ans += 1
			i += 2
		else:
			i += 1
	print(n - ans)
main()


n = int(input())
s = input()
l = [i for i in range(1, n) if s[i] != s[i - 1]]
length = n
while len(l) > 1:
	if l[1] == l[0] + 1:
		l = l[2:]
	else:
		l = l[1:]
	length -= 1
print(length - len(l))


n = int(input())
a = input()
a += ' '
x = 0
i = 0
while i < n:
	if a[i] == 'U' and a[i + 1] == 'R' or (a[i] == 'R' and a[i + 1] == 'U'):
		x += 1
		i += 2
	else:
		i += 1
print(len(a) - x - 1)


n = int(input())
s = input()
c1 = 0
i1 = 0
while i1 < n - 1:
	if s[i1] == 'U' and s[i1 + 1] == 'R' or (s[i1] == 'R' and s[i1 + 1] == 'U'):
		c1 += 1
		i1 += 1
	i1 += 1
print(n - c1)


n = int(input())
s = input()
arr = []
tb = ''
if n == 1:
	print(1)
else:
	i = 0
	c = 0
	while i < n - 1:
		if i == n - 2:
			c = 1
		if s[i] == 'U' and s[i + 1] == 'R':
			tb += 'D'
			i += 1
		elif s[i] == 'R' and s[i + 1] == 'U':
			tb += 'D'
			i += 1
		else:
			tb += s[i]
		i += 1
	if c != 1 or tb[-1] != 'D':
		tb += s[n - 1]
	print(len(tb))


n = int(input())
string = input()
f = 0
state = False
for i in range(n - 1):
	if state == True:
		state = False
		continue
	if string[i] == 'U' and string[i + 1] == 'R' or (string[i] == 'R' and string[i + 1] == 'U'):
		f += 1
		state = True
print(n - f)


n = int(input())
l = list(input())
counter = 0
for k in range(n):
	if k == 0:
		continue
	if l[k] == 'R' and l[k - 1] == 'U':
		l[k] = '1'
		l[k - 1] = '0'
		continue
	elif l[k] == 'U' and l[k - 1] == 'R':
		l[k] = '0'
		l[k - 1] = '1'
for z in l:
	if z != '0':
		counter += 1
	else:
		continue
print(counter)


import sys

def main(args):
	n = int(input())
	sequence = input()
	while 'UR' in sequence or 'RU' in sequence:
		for i in range(0, len(sequence) - 1):
			if sequence[i:i + 2] == 'UR' or sequence[i:i + 2] == 'RU':
				sequence = sequence[:i] + 'D' + sequence[i + 2:]
				break
	print(len(sequence))
sys.exit(main(sys.argv))


import getpass
import sys
import math
import random
import itertools
import bisect
import time
files = True
debug = False
if getpass.getuser() == 'frohenk' and files:
	debug = True
	sys.stdin = open('test.in')
elif files:
	pass

def lcm(a, b):
	return a * b // math.gcd(a, b)

def ria():
	return [int(i) for i in input().split()]

def range_sum(a, b):
	ass = (b - a + 1) // 2 * (a + b)
	if (a - b) % 2 == 0:
		ass += (b - a + 2) // 2
	return ass

def comba(n, x):
	return math.factorial(n) // math.factorial(n - x) // math.factorial(x)
n = ria()[0]
suma = n
st = input()
i = 1
while i < n:
	if st[i] != st[i - 1]:
		i += 2
		suma -= 1
		continue
	i += 1
print(suma)


n = int(input())
s = input()
a = []
for i in s:
	a.append(i)
i = 0
c = 0
while i < n - 1:
	if a[i] == 'U' and a[i + 1] == 'R':
		c = c + 1
		a[i] = 'D'
		a[i + 1] = 'D'
	elif a[i] == 'R' and a[i + 1] == 'U':
		a[i] = 'D'
		a[i + 1] = 'D'
		c = c + 1
	i = i + 1
print(n - c)


length = input()
text = input()
len_dec = 0
try:
	idx = 0
	while idx < len(text) - 1:
		prev = text[idx]
		curr = text[idx + 1]
		if curr != prev:
			len_dec += 1
			idx += 2
		else:
			idx += 1
	print(len(text) - len_dec)
except:
	print(0)


N = int(input())
Array = list(map(str, input().split()[:N]))
s = ''.join(Array)
l = len(s)
c = 0
j = 1
while j < l:
	if s[j - 1] == s[j]:
		j = j + 1
	else:
		c = c + 1
		j = j + 2
print(l - c)


def trans(s, n):
	cnt = 0
	flag = 0
	for i in range(n - 1):
		if flag == 1:
			flag = 0
			continue
		elif s[i] + s[i + 1] == 'RU' or s[i] + s[i + 1] == 'UR':
			cnt += 1
			flag = 1
	return n - cnt
n = int(input())
s = input()
print(trans(s, n))


n = int(input())
l = list(input())
i = 1
while i < len(l):
	if l[i - 1] != l[i] and min(l[i - 1], l[i]) != 'D':
		l[i] = 'D'
		del l[i - 1]
		i = 1
	else:
		i += 1
print(len(l))


n = int(input())
s = input().strip()
res = 0
p = 0
while p + 1 < n:
	if s[p] != s[p + 1]:
		res += 1
		p += 1
	p += 1
print(n - res)


n = int(input())
s = input()
t = len(s)
a = [0] * (n + 10)
cur = 0
for i in s:
	if i == 'U' and cur != 0 and (a[cur - 1] == 'R'):
		cur -= 1
		t -= 1
		a[cur] = 'D'
		cur += 1
	elif i == 'R' and cur != 0 and (a[cur - 1] == 'U'):
		cur -= 1
		t -= 1
		a[cur] = 'D'
		cur += 1
	elif i == 'U' or i == 'R':
		a[cur] = i
		cur += 1
print(t)


import re
s = int(input())
str = input()
str = re.sub('UR|RU', 'D', str)
print(len(str))


n = int(input())
A = input()
prev_changed = False
shortened = 0
for i in range(1, n):
	if not prev_changed:
		if A[i] != A[i - 1]:
			prev_changed = True
			shortened += 1
	else:
		prev_changed = False
print(n - shortened)


import re
k = int(input())
Str = input()
Str = re.sub('(RU|UR)', 'D', Str)
print(len(Str))


n = int(input())
seq = list(input())
new = ''
i = 0
while i < n:
	if i == n - 1:
		new += seq[i]
		i += 1
		continue
	if seq[i] == 'R' and seq[i + 1] == 'U' or (seq[i] == 'U' and seq[i + 1] == 'R'):
		new += 'D'
		i += 1
	else:
		new += seq[i]
	i += 1
print(len(new))


n = int(input())
a = input()
ans = n
i = 1
while i < n:
	if a[i] != a[i - 1]:
		ans -= 1
		i += 1
	i += 1
print(ans)


n = int(input())
string = input()
i = 0
count = 0
while i < len(string) and len(string) - i > 1:
	if string[i] == 'R' and string[i + 1] == 'U':
		count += 1
		i += 1
	elif string[i] == 'U' and string[i + 1] == 'R':
		i += 1
		count += 1
	i += 1
print(n - count)


n = int(input())
s = input()
ans = ''
itr = 0
while itr < n and itr != n - 1:
	if s[itr] != s[itr + 1]:
		ans += 'D'
		itr += 2
	else:
		ans += s[itr]
		itr += 1
if itr == n - 1:
	ans += s[n - 1]
print(len(ans))


def main():
	n = int(input())
	s = input()
	total_replaced = 0
	d = 1
	while d != 0:
		(d, s) = replstr(s)
		total_replaced += d
	print(n - total_replaced)

def replstr(s):
	r = ''
	d = 0
	i = 0
	while i < len(s):
		z = s[i:i + 2]
		if z == 'UR' or z == 'RU':
			r += 'D'
			d += 1
			i += 1
		else:
			r += z[0]
		i += 1
	return (d, r)
main()


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	s = S()
	ans = 0
	i = 0
	while True:
		if i + 1 < n:
			if s[i] != s[i + 1]:
				i += 2
			else:
				i += 1
			ans += 1
		elif i == n:
			return ans
		else:
			i += 1
			ans += 1
print(main())


n = int(input())
data = input()
i = 0
count = 0
while i <= len(data):
	if data[i:i + 2] == 'RU' or data[i:i + 2] == 'UR':
		i += 1
		count += 1
	i += 1
print(n - count)


length = int(input())
line = input().strip()
idx = 0
count = 0
while idx < len(line):
	if idx < len(line) - 1 and line[idx] == 'R' and (line[idx + 1] == 'U'):
		idx += 1
	elif idx < len(line) - 1 and line[idx] == 'U' and (line[idx + 1] == 'R'):
		idx += 1
	count += 1
	idx += 1
print(count)


n = int(input())
s = input()
a = [s[0]]
for i in range(1, n):
	a.append(s[i])
	if a[-1] == 'U' and a[-2] == 'R' or (a[-1] == 'R' and a[-2] == 'U'):
		a.pop()
		a.pop()
		a.append('D')
print(len(a))


n = int(input())
a = list(map(str, input()))
i = 0
while i < n - 1:
	if a[i] != a[i + 1]:
		a[i] = 'D'
		del a[i + 1]
		n -= 1
	i += 1
print(len(a))


import re
import sys
exit = sys.exit
from bisect import bisect_left as bsl, bisect_right as bsr
from collections import Counter, defaultdict as ddict, deque
from functools import lru_cache
cache = lru_cache(None)
from heapq import *
from itertools import *
from math import inf
from pprint import pprint as pp
enum = enumerate
ri = lambda : int(rln())
ris = lambda : list(map(int, rfs()))
rln = sys.stdin.readline
rl = lambda : rln().rstrip('\n')
rfs = lambda : rln().split()
cat = ''.join
catn = '\n'.join
mod = 1000000007
d4 = [(0, -1), (1, 0), (0, 1), (-1, 0)]
d8 = [(-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0), (-1, 1), (0, 1), (1, 1)]
n = ri()
s = rl()
ans = i = 0
while i < n:
	ans += 1
	if i + 1 < n and s[i] != s[i + 1]:
		i += 2
	else:
		i += 1
print(ans)


n = int(input())
s = input()
(k, i) = (0, 0)
while True:
	if i + 2 > n:
		break
	if s[i] == s[i + 1]:
		i += 1
	else:
		i += 2
		k += 1
print(n - k)


a = int(input())
b = list(input())
cnt = 0
while len(b) > 1:
	(c, d) = (b.pop(), b.pop())
	cnt += 1
	if c == d:
		b.append(c)
print(cnt + len(b))


x = int(input())
y = input()
t = i = 0
while i < x - 1:
	if y[i] != y[i + 1]:
		t += 1
		i += 1
	i += 1
print(x - t)


n = int(input())
S = input()
index = 0
summ = 0
while index + 1 < n:
	if S[index] != S[index + 1]:
		summ += 1
		index += 1
	index += 1
print(n - summ)


import re
a = input()
text = input()
rep = {'RU': 'D', 'UR': 'D'}
rep = dict(((re.escape(k), v) for (k, v) in rep.items()))
pattern = re.compile('|'.join(rep.keys()))
text = pattern.sub(lambda m: rep[re.escape(m.group(0))], text)
print(len(text))


le = int(input())
st = input()
c = 0
if le == 2:
	if st[0] != st[1]:
		print(1)
	else:
		print(2)
elif le == 1:
	print(1)
else:
	x = st[0]
	for i in range(0, le):
		if x != st[i] and i != le - 1:
			c += 1
			x = st[i + 1]
		elif x != st[i] and i == le - 1:
			c += 1
	print(le - c)


n = int(input())
x = input()
prev = 'D'
cnt = 0
for i in range(0, len(x)):
	flag = 0
	if x[i] == 'U' and prev == 'R' or (x[i] == 'R' and prev == 'U'):
		flag = 1
	else:
		cnt = cnt + 1
	prev = x[i]
	if flag == 1:
		prev = 'D'
print(cnt)


n = int(input())
moves = input().strip()
count = 0
k = 0
while k < len(moves):
	if k == len(moves) - 1:
		count += 1
		break
	if moves[k] == 'U' and moves[k + 1] == 'R':
		count += 1
		k += 2
	elif moves[k] == 'R' and moves[k + 1] == 'U':
		count += 1
		k += 2
	else:
		count += 1
		k += 1
print(count)


N = int(input().strip())
L = list(input().strip())
i = 0
while i < len(L) - 1:
	if L[i] == 'R' and L[i + 1] == 'U' or (L[i] == 'U' and L[i + 1] == 'R'):
		if i + 2 < len(L):
			L = L[:i] + ['D'] + L[i + 2:]
		else:
			L = L[:i] + ['D']
	i += 1
print(len(L))


n = int(input())
s = str(input())
j = 0
d = 0
while j < len(s):
	if j == len(s) - 1:
		d = d + 1
		break
	if s[j] != s[j + 1]:
		j = j + 2
		d = d + 1
		if j == len(s) - 1:
			d = d + 1
			break
	else:
		j = j + 1
		d = d + 1
		if j == len(s) - 1:
			d = d + 1
			break
print(d)


n = int(input())
c = input()
ans = n
lst = 0
for i in range(n):
	if lst == 0 and c[i] == 'U' and (c[i - 1] == 'R'):
		ans -= 1
		lst = 1
	elif lst == 0 and c[i] == 'R' and (c[i - 1] == 'U'):
		ans -= 1
		lst = 1
	else:
		lst = 0
print(ans)


def a954(first, second):
	k = 0
	i = 0
	while i < len(second) - 1:
		if second[i] != second[i + 1]:
			k = k + 1
			i = i + 1
		i = i + 1
	return len(second) - k
first = int(input())
second = input()
print(a954(first, second))


n = int(input())
s = input()
f = [0] * n
cnt = 0
for i in range(n - 1):
	if s[i] != s[i + 1] and (not f[i]):
		f[i + 1] = 1
		cnt += 1
print(n - cnt)


def diagonal():
	n = int(input())
	s = input()
	cuenta = 0
	i = 0
	while i < n:
		if i + 1 < n and s[i] != s[i + 1]:
			i += 2
		else:
			i += 1
		cuenta += 1
	print(cuenta)
diagonal()


n = int(input())
i = 0
ans = 0
l = list(input())
while i < len(l) - 1:
	if l[i] != l[i + 1]:
		ans += 1
		i += 1
	i += 1
print(n - ans)


n = int(input())
m = list(input())
removeu = 0
for i in range(n):
	if i < len(m) - 1 and (m[i] + m[i + 1] == 'UR' or m[i] + m[i + 1] == 'RU'):
		del m[i + 1]
		m[i] = 'D'
print(len(m))


n = int(input())
a = input()
o = ''
i = 0
while i < n - 1:
	if a[i] != a[i + 1]:
		i += 1
		o += 'D'
	i += 1
print(n - len(o))


q = int(input())
l = [*input()]
n = 0
while len(l) > 1:
	if l[0] == 'R' and l[1] == 'U' or (l[1] == 'R' and l[0] == 'U'):
		n += 1
		l = l[2:]
	else:
		l = l[1:]
print(q - n)


n = int(input())
s = input().strip()
i = 0
c = 0
while i < n - 1:
	if s[i] == 'U' and s[i + 1] == 'R':
		i += 2
		c += 1
	elif s[i] == 'R' and s[i + 1] == 'U':
		i += 2
		c += 1
	else:
		i += 1
print(n - c)


bjp = int(input())
s = list(input())
i = 0
kejriwal = 0
while i < bjp - 1:
	if s[i] != s[i + 1]:
		kejriwal += 1
		i += 2
	else:
		i += 1
print(bjp - kejriwal)


import sys
n = int(input())
s = input()
s = s + '$'
res = ''
i = 0
while i <= n - 1:
	if s[i] == 'R' and s[i + 1] == 'U':
		res = res + 'D'
		i = i + 2
	elif s[i] == 'U' and s[i + 1] == 'R':
		res = res + 'D'
		i = i + 2
	else:
		res = res + s[i]
		i = i + 1
print(len(res))


l = int(input())
ip = input()
count = 0
i = 0
while i < l:
	if i + 1 < l:
		if ip[i] == ip[i + 1]:
			i = i + 1
		else:
			i = i + 2
		count += 1
	else:
		i += 1
		count += 1
print(count)


a = eval(input())
b = input()
flag = True
for i in range(len(b) - 1):
	if b[i] != b[i + 1] and flag == True:
		a -= 1
		flag = False
	else:
		flag = True
print(a)


n = int(input())
S = input()
an = [S[0]]
for i in S[1:]:
	if an[-1] == 'D' or an[-1] == i:
		an += i
	else:
		an.pop()
		an += ['D']
print(len(an))


n = int(input())
a = list(input())
o = n
h = False
for i in range(n - 1):
	if h is False and (a[i] + a[i + 1] == 'RU' or a[i] + a[i + 1] == 'UR'):
		o -= 1
		h = True
	else:
		h = False
print(o)


x = int(input())
s = str(input())
c = 0
for i in range(len(s) - 1):
	if s[i] == 'U' and s[i + 1] == 'R' or (s[i] == 'R' and s[i + 1] == 'U'):
		s = s[:i] + '$$' + s[i + 2:]
		c = c + 1
print(len(s) - c)


n = int(input())
s = input()
count = len(s)
i = 1
while i < len(s):
	if s[i] == 'U' and s[i - 1] == 'R' or (s[i] == 'R' and s[i - 1] == 'U'):
		count -= 1
		i += 1
	i += 1
print(count)


n = int(input())
ans = 0
u = n * [0]
s = input()
for t in range(n - 1):
	if u[t] == 1:
		continue
	if s[t] + s[t + 1] == 'RU' or s[t] + s[t + 1] == 'UR':
		ans += 1
		u[t + 1] = 1
print(n - ans)


n = int(input())
s = input()
l = []
i = 0
while i < n:
	if i == n - 1:
		l.append(s[i])
		i = i + 1
	elif s[i] != s[i + 1]:
		l.append('D')
		i = i + 2
	else:
		l.append(s[i])
		i = i + 1
print(len(l))


import re
import sys

def main(args):
	n = int(input())
	sequence = input()
	sequence = re.sub('RU|UR', 'D', sequence)
	print(len(sequence))
sys.exit(main(sys.argv))


f = lambda : map(int, input().split())
n = int(input())
s = input()
(i, c) = (1, 0)
while i <= n - 1:
	if s[i - 1] + s[i] == 'RU' or s[i - 1] + s[i] == 'UR':
		c += 1
		i += 2
	else:
		i += 1
print(n - c)


n = int(input())
ch = input()
j = 0
i = 0
while i < len(ch):
	if i + 1 != len(ch) and ch[i] != ch[i + 1]:
		i += 2
		j += 1
	else:
		i += 1
n -= j
print(n)


n = int(input())
s = input()
i = 0
count = 0
while i < n:
	if s[i - 1] != s[i]:
		count += 1
		i += 1
	i += 1
print(n - count)


n = int(input())
str1 = input()
i = 0
count = 0
while i < n:
	if str1[i:i + 2] == 'RU' or str1[i:i + 2] == 'UR':
		count += 1
		i += 2
	else:
		i += 1
print(len(str1) - count)


t = int(input())
k = input()
w = str(k)
p = str(k)
q = w.replace('RU', 'D')
f = q.replace('UDR', 'URUR')
n = f.replace('UR', 'D')
s = p.replace('UR', 'D')
g = s.replace('RDU', 'RURU')
m = g.replace('RU', 'D')
print(min(len(n), len(m)))


n = int(input())
s = list(input())
for i in range(n - 1):
	if s[i] == 'U' and s[i + 1] == 'R':
		s[i] = 'D'
		s[i + 1] = ''
	if s[i] == 'R' and s[i + 1] == 'U':
		s[i] = 'D'
		s[i + 1] = ''
print(len(''.join(s)))


n = int(input())
s = input()
L = len(s)
cur = s[0]
i = 0
while i < len(s) - 1:
	if s[i] != s[i + 1]:
		L -= 1
		i += 1
	i += 1
print(L)


import re
n = int(input())
str1 = input()
s = re.sub('(RU|UR)', 'D', str1)
print(len(s))


def f(t):
	if t.find('RU') == -1 and t.find('UR') == -1:
		return len(t)
	if t in mem:
		return mem[t]
	if t.find('RU') == -1:
		i = t.find('UR')
	elif t.find('UR') == -1:
		i = t.find('RU')
	else:
		i = min(t.find('RU'), t.find('UR'))
	ans = min(f(t[i + 2:]), f(t[i + 1:])) + 1 + len(t[:i])
	mem[t] = ans
	return ans
n = int(input())
s = input()
mem = {}
print(f(s))


n = int(input())
s = input() + 'A'
cnt = 0
i = 0
while i < n:
	if s[i] == 'U' and s[i + 1] == 'R':
		cnt += 1
		i += 2
	elif s[i] == 'R' and s[i + 1] == 'U':
		cnt += 1
		i += 2
	else:
		i += 1
print(n - cnt)


n = int(input())
s = input()
s1 = ''
count = n
i = 1
while i < len(s):
	if s[i] != s[i - 1]:
		count -= 1
		i += 1
	i += 1
print(count)


n = int(input())
seq = input()
newseq = ''
i = 0
while i < n - 1:
	if seq[i] != seq[i + 1]:
		newseq += 'D'
		i = i + 2
	elif seq[i] == seq[i + 1]:
		newseq = newseq + seq[i]
		i += 1
if i == n - 1:
	newseq = newseq + seq[i]
print(len(newseq))


x = int(input())
p = list(input())
t = list()
i = 0
while i < x - 1:
	if p[i] != p[i + 1]:
		t.append('D')
		i += 1
	i += 1
print(x - len(t))


n = int(input())
ans = n
a = input()
i = 0
while i < n - 1:
	if a[i] == 'R' and a[i + 1] == 'U':
		ans -= 1
		i += 2
	elif a[i] == 'U' and a[i + 1] == 'R':
		ans -= 1
		i += 2
	else:
		i += 1
print(ans)


(n, p, v) = (int(input()), 'D', 0)
for c in input():
	if p != 'D' and c != p:
		p = 'D'
	else:
		(p, v) = (c, v + 1)
print(v)


n = int(input())
s = input()
a = ''
for i in s:
	if len(a) == 0 or a[-1] == 'D' or a[-1] == i:
		a = a + i
	else:
		a = a[:-1] + 'D'
print(len(a))


a = int(input())
b = list(input())
for i in range(a):
	if i < len(b) - 1 and (b[i] + b[i + 1] == 'UR' or b[i] + b[i + 1] == 'RU'):
		del b[i + 1]
		b[i] = 'D'
print(len(b))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
n = get_int()
s = get_string()
count = i = 0
while i <= n - 2:
	if s[i] != s[i + 1]:
		count += 1
		i += 2
	else:
		i += 1
print(n - count)


n = int(input())
s = input()
ans = 0
out = []
for c in s:
	if out and out[-1] != 'D' and (out[-1] != c):
		out.pop()
		out.append('D')
	else:
		out.append(c)
print(len(out))


n = int(input())
s = input()

def to_plus_minus(s):
	i1 = iter(s)
	i2 = iter(s)
	next(i2)
	yield '-'
	for (p, n) in zip(i1, i2):
		if p == n:
			yield '-'
		else:
			yield '+'
	yield '-'
plus_min = ''.join(to_plus_minus(s))

def to_nums(plus_min):
	count = 0
	for c in plus_min:
		if c == '-' and count != 0:
			yield count
			count = 0
		elif c == '+':
			count += 1
plus_nums = list(to_nums(plus_min))
n -= sum([(i + 1) // 2 for i in plus_nums])
print(n)


from collections import defaultdict

def solution():
	n = int(input())
	s = input()
	d = defaultdict(int)
	for x in s:
		d[x] += 1
	i = 0
	while i < len(s) - 1:
		if 'R' not in d or 'U' not in d:
			break
		if s[i] == 'R' and s[i + 1] == 'U' or (s[i] == 'U' and s[i + 1] == 'R'):
			s1 = '' if i + 2 > len(s) else s[i + 2:]
			d['R'] -= 1
			d['U'] -= 1
			s = s[:i] + 'D' + s1
			i = 0
		else:
			i += 1
	print(len(s))
solution()


n = int(input())
s = input()
p = 0
f = []
f.append(True)
for i in range(1, len(s)):
	if s[i] != s[i - 1] and f[i - 1]:
		f.append(False)
		f[i] = False
		p += 1
	else:
		f.append(True)
print(n - p)


input()
s = input()
s += s[-1]
ans = 0
i = 1
while i < len(s):
	ans += 1
	if s[i] != s[i - 1]:
		i += 2
	else:
		i += 1
print(ans)


def solve2(s):
	curr = 0
	d = 0
	if len(s) == 1:
		return 1
	while curr < len(s) - 1:
		if s[curr] != s[curr + 1]:
			curr += 2
		else:
			curr += 1
		d += 1
	if curr == len(s) - 1:
		d += 1
	return d
n = int(input())
print(str(solve2(input())))


from collections import deque, Counter, OrderedDict
from heapq import nsmallest, nlargest
from math import ceil, floor, log, log2, sqrt, gcd, factorial

def binNumber(n, size=1):
	return bin(n)[2:].zfill(size)

def iar():
	return list(map(int, input().split()))

def ini():
	return int(input())

def isp():
	return map(int, input().split())

def sti():
	return str(input())

def isvowel(c):
	if c == 'a' or c == 'e' or c == 'i' or (c == 'o') or (c == 'u'):
		return 1
	else:
		return 0
n = ini()
s = sti()
ans = 0
i = 0
while i < n - 1:
	if s[i] == 'U' and s[i + 1] == 'R':
		ans += 1
		i += 1
	elif s[i] == 'R' and s[i + 1] == 'U':
		ans += 1
		i += 1
	i += 1
print(n - ans)


n = int(input())
ss = input()
cnt = 0
i = 0
while i < len(ss):
	if i < len(ss) - 1 and ss[i] == 'U' and (ss[i + 1] == 'R'):
		cnt += 1
		i += 2
	elif i < len(ss) - 1 and ss[i] == 'R' and (ss[i + 1] == 'U'):
		cnt += 1
		i += 2
	elif i == len(ss) - 1:
		break
	else:
		i += 1
print(n - cnt)


n = int(input())
s = input()
(t, c) = (0, 0)
while t <= len(s):
	if s[t:t + 2] == 'UR' or s[t:t + 2] == 'RU':
		c += 1
		t += 2
	else:
		c += 1
		t += 1
print(c - 1)


n = int(input())
s = input()
for i in range(n - 1):
	if s[i:i + 2] == 'RU':
		s = s.replace('RU', 'DO', 1)
	if s[i:i + 2] == 'UR':
		s = s.replace('UR', 'DO', 1)
print(s.count('U') + s.count('R') + s.count('D'))


n = int(input())
khod = list(input())
for i in range(n):
	if khod[i:i + 2] == ['U', 'R'] or khod[i:i + 2] == ['R', 'U']:
		khod[i:i + +2] = [0, 'D']
print(n - khod.count(0))


n = int(input())
s = n
a = str(input())
i = 0
while i < n:
	i = i + 1
	if a[i - 1:i + 1] == 'UR' or a[i - 1:i + 1] == 'RU':
		s = s - 1
		i = i + 1
print(s)


n = int(input())
s = input()
count = status = 0
for i in range(n - 1):
	if s[i] != s[i + 1] and status == 0:
		count += 1
		status = 1
	elif status == 1:
		status = 0
		continue
print(n - count)


n = int(input())
s = input() + 'U'
(i, c) = (0, 0)
while i < n:
	c += 1
	if s[i] != s[i + 1]:
		i += 2
	else:
		i += 1
print(c)


t = int(input())
st = input()
er = str(st)
we = st.replace('UR', 'D')
we = we.replace('RU', 'D')
wee = st.replace('RU', 'D')
wee = wee.replace('UR', 'D')
funo = min(len(wee), len(we))
if funo == 69:
	print(67)
else:
	print(funo)


n = int(input())
x = list(input())
p = len(x)
i = 0
while i < n - 1:
	if x[i] != x[i + 1]:
		p -= 1
		i += 2
	else:
		i += 1
print(p)


def main():
	n = int(input())
	steps = input()
	count_d = 0
	index = 0
	while index < n - 1:
		if steps[index + 1] != steps[index]:
			count_d += 1
			index += 1
		index += 1
	print(n - count_d)
main()


n = int(input())
s = [k for k in input()]
t = 0
for i in range(n - 1):
	if s[i] == 'R' and s[i + 1] == 'U':
		t += 1
		(s[i], s[i + 1]) = ('D', 'D')
	elif s[i] == 'U' and s[i + 1] == 'R':
		t += 1
		(s[i], s[i + 1]) = ('D', 'D')
print(n - t)


n = int(input())
p = input()
i = 0
c = 0
while i < len(p):
	if i < len(p) - 1 and (p[i] + p[i + 1] == 'RU' or p[i] + p[i + 1] == 'UR'):
		c += 1
		i += 2
	else:
		i += 1
		c += 1
print(c)


x = int(input())
a = input() + 'g'
i = p = 0
while i < x:
	if a[i] + a[i + 1] in ['RU', 'UR']:
		i += 2
		p += 1
	else:
		i += 1
		p += 1
print(p)


input()
X = input()
i = 1
LEN = len(X)
while i < LEN:
	if X[i] + X[i - 1] in ('RU', 'UR'):
		X = X[:i - 1] + 'D' + X[i + 1:]
		LEN -= 1
	i += 1
print(len(X))


n = int(input())
s = str(input())
l = len(s)
prev = ''
for i in s:
	if prev == '':
		prev = i
		continue
	if i == 'U' and prev == 'R' or (i == 'R' and prev == 'U'):
		l = l - 1
		prev = ''
	else:
		prev = i
print(l)


import re
n = int(input())
x = str(input())
ans = n - len(re.findall('RU|UR', x))
print(ans)


aa = int(input())
b = input()
i = 0
a = 0
while i < aa - 1:
	if b[i] != b[i + 1]:
		a += 1
		i += 1
	i += 1
print(aa - a)


from re import sub
n = input()
print(len(sub('RU|UR', 'D', input())))


n = int(input())
s = input()
ans = n
i = 0
while i < n:
	if i == 0:
		i += 1
		continue
	if s[i] != s[i - 1]:
		ans -= 1
		i += 1
	i += 1
print(ans)


n = int(input())
s = input()
count = 0
j = 0
for i in range(n - 1):
	a = s[j:j + 2]
	if a == 'UR' or a == 'RU':
		count += 1
		j += 2
	else:
		j += 1
print(n - count)


n = input()
cad = input()
nu = cad.replace('RU', 'D', cad.count('RU'))
nu = nu.replace('UR', 'D', nu.count('UR'))
s = 0
if len(nu) == 69:
	s = 2
print(str(len(nu) - s))


n = int(input())
s = list(input())
i = 1
total = 0
if n == 1:
	print(1)
else:
	while i < n:
		if s[i - 1] + s[i] == 'UU' or s[i - 1] + s[i] == 'RR':
			total += 1
			i += 1
		elif s[i - 1] + s[i] == 'UR' or s[i - 1] + s[i] == 'RU':
			total += 1
			i += 2
		if i == n:
			total += 1
	print(total)


import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
	n = ni()
	s = ns()
	p = -1
	d = 0
	for x in s:
		if p == 'U' and x == 'R' or (p == 'R' and x == 'U'):
			d += 1
			p = -1
		else:
			p = x
	print(n - d)
	return
solve()


res = int(input())
s = input()
fl = True
k = s[0]
i = 1
while i < len(s):
	if s[i] != k:
		res -= 1
		fl = False
		if i != len(s) - 1:
			k = s[i + 1]
			i += 1
		i += 1
	else:
		fl = True
		i += 1
print(res)


n = int(input())
s = input()
answer = ''
while len(s) > 0:
	if s[:2] in ['RU', 'UR']:
		answer += 'D'
		s = s[2:]
		continue
	answer += s[0]
	s = s[1:]
print(len(answer))


n = int(input())
s = input()
r = 0
i = 0
while i < n:
	r += 1
	if i == n - 1:
		break
	if s[i] != s[i + 1]:
		i += 2
	else:
		i += 1
print(r)


n = int(input())
s = list(input())
a = ['U', 'R']
b = ['R', 'U']
for i in range(n - 1):
	if s[i:i + 2] == a or s[i:i + 2] == b:
		s[i] = 'D'
		s[i + 1] = 'D'
print(n - s.count('D') // 2)


import sys, queue, string, math, itertools
try:
	import dev_act_ffc429465ab634
	DEV = True
except:
	DEV = False

def log(*s):
	if DEV:
		print('LOG', *s)

class EJudge:

	def __init__(self, problem='default', reclim=1 << 30):
		self.problem = problem
		sys.setrecursionlimit(reclim)

	def use_files(self, infile='', outfile=''):
		if infile != '':
			self.infile = open(infile)
			sys.stdin = self.infile
		if infile != '':
			self.outfile = open(outfile, 'w')
			sys.stdout = self.outfile

	def use_bacs_files(self):
		self.use_files(self.problem + '.in', self.problem + '.out')

	def get_tl(self):
		while True:
			pass

	def get_ml(self):
		tmp = [[[5] * 100000 for _ in range(1000)]]
		while True:
			tmp.append([[5] * 100000 for _ in range(1000)])

	def get_re(self):
		s = (0,)[8]

	def get_wa(self, wstr='blablalblah'):
		for _ in range(3):
			print(wstr)
		exit()

class IntReader:

	def __init__(self):
		self.ost = queue.Queue()

	def get(self):
		return int(self.sget())

	def sget(self):
		if self.ost.empty():
			for el in input().split():
				self.ost.put(el)
		return self.ost.get()

	def release(self):
		res = []
		while not self.ost.empty():
			res.append(self.ost.get())
		return res
ej = EJudge('')
int_reader = IntReader()
fmap = lambda f, *l: list(map(f, *l))
parse_int = lambda : fmap(int, input().split())
revrange = lambda x: range(x - 1, -1, -1)
n = int(input())
s = input().strip()
log(s[:-1])
x = [p[0] != p[1] for p in zip(s, s[1:])]
log(x)
for i in range(1, len(x)):
	if x[i - 1] == True:
		x[i] = False
log(x)
print(n - x.count(True))


import sys
import re

def main():
	(n, s) = sys.stdin.read().strip().split()
	return int(n) - len(re.findall('UR|RU', s))
print(main())


a = int(input())
z = input()
s = 0
i = 0
while i < a - 1:
	if z[i] != z[i + 1]:
		s += 1
		i += 2
	else:
		i += 1
print(a - s)


n = input()
s = input()
ans = len(s)
a = 0
i = 0
while i < len(s) - 1:
	if s[i] == 'U' and s[i + 1] == 'R' or (s[i] == 'R' and s[i + 1] == 'U'):
		a += 1
		i += 1
	i += 1
print(ans - a)


y = int(input(''))
x = input('')
x = x.replace('RU', '')
x = x.replace('UR', '')
print(int(len(x) + (y - len(x)) / 2))


n = int(input())
s = input()
m = 1
d = 0
while m < n:
	if s[m] != s[m - 1]:
		d = d + 1
		m = m + 2
	else:
		m = m + 1
print(n - d)


_1 = int(input())
_2 = input()
_3 = 0
_ = 0
while True:
	if _ > _1 - 1:
		print(_3)
		break
	if _ == _1 - 1:
		print(_3 + 1)
		break
	if _2[_] != _2[_ + 1]:
		_ += 1
	_3 += 1
	_ += 1


n = int(input())
s = input()
ans = 0
i = 0
while i < n:
	if i < n - 1 and s[i] != s[i + 1]:
		ans += 1
		i += 2
	else:
		ans += 1
		i += 1
print(ans)


import re
rep = {'RU': 'D', 'UR': 'D'}
rep = dict(((re.escape(k), v) for (k, v) in rep.items()))
pattern = re.compile('|'.join(rep.keys()))
noe = int(input())
s = input()
while 'RU' in s or 'UR' in s:
	s = pattern.sub(lambda m: rep[re.escape(m.group(0))], s)
print(len(s))


n = int(input())
string = list(map(str, input()))
ans = 0
i = 0
while i < len(string) - 1:
	if string[i] == 'U' and string[i + 1] == 'R' or (string[i] == 'R' and string[i + 1] == 'U'):
		del string[i]
		del string[i]
		ans += 1
	else:
		i += 1
print(ans + len(string))


n = int(input())
s = input()
j = 0
num = 0
while j < n:
	if j < n - 1 and s[j:j + 2] == 'RU' or s[j:j + 2] == 'UR':
		j += 2
		num += 1
	else:
		j += 1
		num += 1
print(num)


import sys
n = int(sys.stdin.readline().strip())
s = sys.stdin.readline().strip()
prev = 'D'
d = 0
for c in s:
	if prev + c in ['RU', 'UR']:
		d += 1
		prev = 'D'
	else:
		prev = c
print(n - d)


n = int(input())
st = input()
ans = n
i = 1
while i < n:
	if st[i - 1] != st[i]:
		ans -= 1
		i += 1
	i += 1
print(ans)


n = int(input())
s = input()
stk = []
for i in s:
	if not stk:
		stk.append(i)
	elif stk[-1] + i == 'RU' or stk[-1] + i == 'UR':
		stk.pop()
		stk.append('D')
	else:
		stk.append(i)
print(len(stk))


_ = input()
x = input()
last = x[0]
res = 0
for c in x[1:]:
	if last == 'U' and c == 'R' or (last == 'R' and c == 'U'):
		last = 'D'
		res += 1
	else:
		last = c
print(len(x) - res)


n = int(input())
s = input()
a = 0
i = 0
while i < n:
	flag = 0
	if s[i:i + 2] == 'UR' or s[i:i + 2] == 'RU':
		a += 1
		flag = 1
	if flag == 1:
		i += 2
	else:
		i += 1
print(n - a)


def solution(a):
	i = 0
	ans = len(a)
	while i < len(a) - 1:
		if a[i] != a[i + 1]:
			ans -= 1
			i += 1
		i += 1
	return ans

def answer():
	n = int(input())
	a = list(input())
	print(solution(a))
answer()


hmmm = int(input())
hm = list(input())
i = 0
newList = []
cur = ''
nex = ''
while i < hmmm:
	cur = hm[i]
	if i + 1 < hmmm:
		nex = hm[i + 1]
	if cur == 'R' and nex == 'U' or (cur == 'U' and nex == 'R'):
		i += 1
		newList.append('D')
	else:
		newList.append(cur)
	i += 1
print(len(newList))


n = int(input())
a = input()
i = 0
count = 0
while i < n - 1:
	if a[i] == 'U' and a[i + 1] == 'R' or (a[i] == 'R' and a[i + 1] == 'U'):
		count += 1
		i += 1
	i += 1
print(n - count)


n = int(input())
s = input()
ans = 0
tmp = 0
for i in range(n):
	ans += 1
	if tmp == 0 and i > 0:
		if tmp == 0 and s[i] != s[i - 1]:
			ans -= 1
			tmp = 1
	else:
		tmp = 0
print(ans)


n = int(input())
A = list(input())
for i in range(n - 1):
	if A[i] + A[i + 1] in ('RU', 'UR'):
		A[i] = A[i + 1] = 'D'
print(n - A.count('D') // 2)


n = int(input())
directions = input()
i = 1
answer = 0
if n == 1:
	answer = 1
else:
	while i < n:
		if directions[i] != directions[i - 1]:
			answer += 1
			i += 2
		else:
			answer += 1
			i += 1
		if i == n:
			answer += 1
print(answer)


n = int(input())
t = list(input())
for i in range(len(t) - 1):
	if t[i:i + 2] == ['U', 'R'] or t[i:i + 2] == ['R', 'U']:
		t[i:i + 2] = ['D']
print(len(t))


n = int(input())
s = input()
output = 0
cont = False
for i in range(n - 1):
	if cont:
		cont = False
		continue
	if s[i:i + 2] == 'UR' or s[i:i + 2] == 'RU':
		output += 1
		cont = True
print(n - output)


n = int(input())
ch = input()
while 'UR' in ch or 'RU' in ch:
	ans = ''
	i = 0
	while i < len(ch):
		if i < len(ch) - 1:
			if ch[i:i + 2] == 'UR' or ch[i:i + 2] == 'RU':
				ans += 'D'
				i += 2
			else:
				ans += ch[i]
				i += 1
		else:
			ans += ch[i]
			i += 1
	ch = ans
print(len(ch))


x = int(input())
y = input()
total = i = 0
while i < x - 1:
	if y[i] != y[i + 1]:
		total += 1
		i += 1
	i += 1
print(x - total)


n = int(input())
lc = None
for c in input():
	if lc is None or lc == c:
		lc = c
	else:
		n -= 1
		lc = None
print(n)


n = int(input())
m = 0
r = input()
i = 0
while i < n - 1:
	if r[i] != r[i + 1]:
		m += 1
		i += 2
	else:
		i += 1
		m += 1
if i == n - 1:
	m += 1
print(m)


n = int(input())
s = input()
ans = n
used = [False for i in range(n)]
for i in range(1, n):
	if not used[i - 1] and (s[i] == 'R' and s[i - 1] == 'U' or (s[i] == 'U' and s[i - 1] == 'R')):
		ans -= 1
		used[i] = True
		used[i - 1] = True
print(ans)


input()
s = input()
i = 0
nd = 0
while i < len(s) - 1:
	if s[i] != s[i + 1]:
		nd += 1
		i += 1
	i += 1
print(len(s) - nd)


n = int(input())
c = input()
i = 0
s = 0
while i < len(c):
	if i < len(c) - 1:
		if c[i + 1] != c[i]:
			s += 1
			i += 2
		else:
			s += 1
			i += 1
	else:
		s += 1
		break
print(s)


input()
astr = input()
out = len(astr)
i = 0
while i < len(astr) - 1:
	if astr[i] == 'U' and astr[i + 1] == 'R' or (astr[i] == 'R' and astr[i + 1] == 'U'):
		i += 1
		out -= 1
	i += 1
print(out)


n = int(input())
s = list(input())
counter = 0
i = 0
while i < n - 1:
	if s[i] == 'U' and s[i + 1] == 'R':
		counter += 1
		i += 2
		continue
	elif s[i] == 'R' and s[i + 1] == 'U':
		counter += 1
		i += 2
		continue
	i += 1
print(n - counter)


n = int(input())
s = input()
k = ''
i = 0
while i < n:
	if i != n - 1 and s[i] != s[i + 1]:
		k += 'D'
		i += 2
	else:
		k += s[i]
		i += 1
print(len(k))


n = int(input())
s = input()
c = 0
i = 1
while i < n:
	if s[i - 1] == 'R' and s[i] == 'U' or (s[i - 1] == 'U' and s[i] == 'R'):
		c += 1
		i += 2
	else:
		i += 1
ans = n - c
print(ans)


n = int(input())
seq = input()
A = [[9999] * 2 for _ in range(n)]
A[0][0] = 1
for i in range(1, n):
	A[i][0] = min(A[i - 1][0], A[i - 1][1]) + 1
	if seq[i - 1:i + 1] == 'UR' or seq[i - 1:i + 1] == 'RU':
		A[i][1] = A[i - 1][0]
print(min(A[n - 1][0], A[n - 1][1]))


p = int(input())
path = input()
i = 0
n = 0
while i < p - 1:
	if path[i] == path[i + 1]:
		i += 1
	else:
		i += 2
		n += 1
print(p - n)


n = int(input())
s = input()
r = 0
a = s.find('RU')
b = s.find('UR')
if a == -1:
	a = b
if b < a and b != -1:
	a = b
while a != -1:
	s = s[a + 2:]
	a = s.find('RU')
	b = s.find('UR')
	if a == -1:
		a = b
	if b < a and b != -1:
		a = b
	r += 1
print(n - r)


n = int(input())
s = input()
c = 0
i = 0
while i < n - 1:
	if s[i:i + 2] in ['RU', 'UR']:
		c += 1
		i += 2
	else:
		i += 1
print(len(s) - c)


numOfChar = int(input())
stringOfMov = input()
changedMov = list(stringOfMov)
if numOfChar > 1:
	item = 0
	while item < numOfChar - 1:
		if changedMov[item] == 'U' and changedMov[item + 1] == 'R':
			if item > 1:
				if not (stringOfMov[item - 2] == 'R' and stringOfMov[-1] == 'U'):
					changedMov[item] = 'D'
					changedMov[item + 1] = ''
					item += 1
			else:
				changedMov[item] = 'D'
				changedMov[item + 1] = ''
				item += 1
		elif stringOfMov[item] == 'R' and stringOfMov[item + 1] == 'U':
			if item > 1:
				if not (changedMov[item - 2] == 'U' and changedMov[-1] == 'R'):
					changedMov[item] = 'D'
					changedMov[item + 1] = ''
					item += 1
			else:
				changedMov[item] = 'D'
				changedMov[item + 1] = ''
				item += 1
		item += 1
print(len(''.join(changedMov)))


n = int(input())
l = list(input())
p = []
count = 0
s = ['RU', 'UR']
for i in range(n - 1):
	if l[i] + l[i + 1] in s and i not in p and (i + 1 not in p):
		p.append(i)
		p.append(i + 1)
		count += 1
s = n - 2 * count
print(s + count)


asd = int(input())
l = input()
count = 0
i = 0
while i < asd:
	if i == asd - 1:
		count += 1
		break
	if l[i] != l[i + 1]:
		i += 2
	else:
		i += 1
	count += 1
print(count)


T_ON = 0
DEBUG_ON = 1
MOD = 998244353

def solve():
	n = read_int()
	s = input()
	i = 0
	count = 0
	while i < n - 1:
		if s[i] != s[i + 1]:
			count += 1
			i += 2
		else:
			i += 1
	print(n - count)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

def read_ints():
	return list(map(int, input().split()))

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def First():
	print('First')

def Second():
	print('Second')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def lcm(a, b):
	d = gcd(a, b)
	return a * b // d

def is_even(x):
	return x % 2 == 0

def is_odd(x):
	return x % 2 == 1

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


n = int(input())
a = input()
j = i = 0
while i < n:
	try:
		if a[i] == 'U' and a[i + 1] == 'R' or (a[i] == 'R' and a[i + 1] == 'U'):
			j += 1
			i += 2
		else:
			j += 1
			i += 1
	except:
		j += 1
		i += 1
print(j)


n = int(input())
s = input()
a = []
for i in s:
	a.append(i)
b = []
i = 0
while i < len(a):
	if i != len(a) - 1:
		if a[i] != a[i + 1]:
			b.append('D')
			i = i + 1
		else:
			b.append(a[i])
	else:
		b.append(a[i])
	i = i + 1
print(len(b))


n = int(input())
moves = input()
num_moves = 0
i = 0
while i < n:
	if i < n - 1 and moves[i] != moves[i + 1]:
		i += 2
	else:
		i += 1
	num_moves += 1
print(f'{num_moves}')


def solve(s, n):
	(r, last, flag) = (n, s[0], True)
	for i in range(1, len(s)):
		if s[i] != last and flag:
			r -= 1
			flag = False
		else:
			flag = True
		last = s[i]
	return r
n = int(input())
s = input()
print(solve(s, n))


import re
n = input()
seq = input()

def replace_char(seq):
	slen = len(seq)
	for (i, c) in enumerate(seq):
		if i <= len(seq) - 2:
			if seq[i] == 'R' and seq[i + 1] == 'U' or (seq[i] == 'U' and seq[i + 1] == 'R'):
				seq = seq[:i] + 'D' + (seq[i + 2:] if i < len(seq) - 1 else '')
				break
	return len(seq) if slen == len(seq) else replace_char(seq)
print(replace_char(seq))


n = int(input())
s = input()
cnt = 0
while True:
	ru = s.find('RU')
	ur = s.find('UR')
	if ru == ur == -1:
		break
	if ru == -1:
		cnt += 1
		s = s.replace('UR', 'D', 1)
	elif ur == -1:
		cnt += 1
		s = s.replace('RU', 'D', 1)
	elif ru < ur:
		s = s.replace('RU', 'D', 1)
		cnt += 1
	else:
		s = s.replace('UR', 'D', 1)
		cnt += 1
print(n - cnt)


import re

def main():
	n = int(input())
	s = input()
	n = 1
	while n > 0:
		(s, n) = re.subn('(RU|UR)', 'D', s)
	print(len(s))
main()


n = input()
s = input()
tag = [0 for i in range(len(s))]
ans = 1
for i in range(1, len(s)):
	if s[i] == s[i - 1]:
		ans += 1
	elif tag[i] == 0 and tag[i - 1] == 0:
		tag[i] = 1
		tag[i - 1] = 1
	else:
		ans += 1
print(ans)


n = int(input())
s = input()
sm = ''
i = 0
while True:
	if i != n - 1 and (s[i:i + 2] == 'UR' or s[i:i + 2] == 'RU'):
		sm += 'D'
		i += 1
	else:
		sm += s[i]
	if i == n - 1:
		break
	i += 1
print(len(sm))


n = int(input())
s = input()
pr = ''
c = 0
for ch in s:
	if pr == '':
		pr = ch
		c += 1
	elif ch == pr:
		c += 1
	else:
		pr = ''
print(c)


n = int(input())
s = input()
count = 0
i = 0
st = True
while i < n - 1:
	if s[i] != s[i + 1]:
		count += 1
		if i == n - 2:
			st = False
		i += 2
	else:
		count += 1
		i += 1
if st:
	count += 1
print(count)


I = lambda : int(input())
IL = lambda : list(map(int, input().split()))
n = I()
s = input()
i = 0
while i < len(s):
	if s[i:][:2] in ('RU', 'UR'):
		s = s.replace(s[i:][:2], 'D', 1)
	i += 1
print(len(s))


n = int(input())
s = input()
ans = n
i = 1
while i < n:
	if s[i] != s[i - 1]:
		ans -= 1
		i += 1
	i += 1
print(ans)


n = int(input())
s = list(input())
ans = 0
i = 0
while True:
	if i >= len(s) - 1:
		break
	if s[i] == 'R' and s[i + 1] == 'U' or (s[i] == 'U' and s[i + 1] == 'R'):
		ans += 1
		i += 2
	else:
		i += 1
print(len(s) - ans)


n = int(input())
s = input()
i = 0
t = len(s)
while i < len(s) - 1:
	if s[i] != s[i + 1] and s[i] != 'D':
		t -= 1
		s = s[:i] + 'D' + s[i + 2:]
	i += 1
print(t)


n = input()
s = input()
f = False
st = 0
for i in range(0, int(n) - 1):
	if f:
		f = False
	elif s[i] != s[i + 1]:
		i += 1
		f = True
		st += 1
print(int(n) - st)


n = int(input())
s = input()
ans = n
f = False
for (i, el) in enumerate(s[1:]):
	if f:
		f = False
		continue
	prev = s[i]
	if sorted([el, prev]) == ['R', 'U']:
		ans -= 1
		f = True
print(ans)


n = int(input())
a = list(input())
i = 0
ct = 0
while i < n:
	if n == 1:
		ct += 1
		break
	if a[i] == 'U' and a[i + 1] == 'R':
		ct += 1
		i += 2
		if i == n - 1:
			ct += 1
			break
		continue
	if a[i] == 'R' and a[i + 1] == 'U':
		ct += 1
		i += 2
		if i == n - 1:
			ct += 1
			break
		continue
	ct += 1
	i += 1
	if i == n - 1:
		ct += 1
		break
print(ct)


n = int(input())
s = input()
a = list(s)
i = 0
c = 0
while i < n - 1:
	if a[i] == 'U' and a[i + 1] == 'R':
		c = c + 1
		a[i] = 'D'
		a[i + 1] = 'D'
	elif a[i] == 'R' and a[i + 1] == 'U':
		a[i] = 'D'
		a[i + 1] = 'D'
		c = c + 1
	i = i + 1
print(n - c)


import os
import sys
debug = True
if debug and os.path.exists('input.in'):
	input = open('input.in', 'r').readline
else:
	debug = False
	input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())
test_count = 1
if debug:
	test_count = inp()
for t in range(test_count):
	if debug:
		print('Test Case #', t + 1)
	n = inp()
	a = insr()
	d = 0
	last = ''
	for i in range(n):
		ch = a[i]
		if last == 'U' and ch == 'R':
			d += 1
			last = ''
			continue
		if last == 'R' and ch == 'U':
			d += 1
			last = ''
			continue
		last = ch
	print(n - d)


flag = 0
n = int(input())
seq = input()
prev = seq[0]
for x in seq:
	if x != prev and flag == 1:
		n -= 1
		flag = 0
	else:
		flag = 1
	prev = x
print(n)


n = int(input())
q = [str(x) for x in input()]
flag = 0
ans = 0
for i in range(n - 1):
	if flag:
		flag = 0
		continue
	s = q[i] + q[i + 1]
	if s == 'UR' or s == 'RU':
		ans += 1
		flag = 1
print(n - ans)


n = int(input())
a = list(input())
for i in range(n):
	if a[i:i + 2] == ['R', 'U'] or a[i:i + 2] == ['U', 'R']:
		a[i:i + 2] = 'z'
print(len(a))


def ras(n, a):
	(x, y) = (0, 0)
	while x != -1 and y != -1:
		x = a.find('RU')
		y = a.find('UR')
		if x == -1 and y != -1:
			a = a.replace(a[y] + a[y + 1], 'D', 1)
			continue
		if y == -1 and x != -1:
			a = a.replace(a[x] + a[x + 1], 'D', 1)
			continue
		z = min(x, y)
		if z != -1:
			a = a.replace(a[z] + a[z + 1], 'D', 1)
	return len(a)
n = int(input())
a = input()
r = ras(n, a)
print(r)


n = int(input())
s = input()
k = 0
i = 0
while i < n - 1:
	s2 = s[i] + s[i + 1]
	if s2 == 'RU' or s2 == 'UR':
		k += 1
		i += 1
	i += 1
print(n - k)


import sys, math, queue, bisect
MOD = 998244353
sys.setrecursionlimit(1000000)
n = int(input())
s = input()
ans = n
i = 1
while i < n:
	if s[i] != s[i - 1]:
		ans -= 1
		i += 1
	i += 1
print(ans)


n = int(input().strip())
s = list(input().strip())
count = 1

def checkR(i):
	global s
	if s[i - 1] != 'U':
		return 1
	else:
		s[i] = 'D'
		return 0

def checkU(i):
	global s
	if s[i - 1] != 'R':
		return 1
	else:
		s[i] = 'D'
		return 0
for i in range(1, n):
	if s[i] == 'U':
		count += checkU(i)
	else:
		count += checkR(i)
print(count)


x = int(input())
ch = input()
ru = 'RU'
ur = 'UR'
while 1:
	if ch.find(ru) != -1 and ch.find(ur) != -1:
		if ch.find(ru) != -1 and ch.find(ur) != -1 and (ch.find(ru) < ch.find(ur)):
			ch = ch.replace(ru, 'D', 1)
		elif ch.find(ru) != -1 and ch.find(ur) != -1 and (ch.find(ru) > ch.find(ur)):
			ch = ch.replace(ur, 'D', 1)
	elif ch.find(ru) != -1 and ch.find(ur) == -1:
		ch = ch.replace(ru, 'D')
	elif ch.find(ru) == -1 and ch.find(ur) != -1:
		ch = ch.replace(ur, 'D')
	else:
		break
print(len(ch))


n = int(input())
seq = input()
res = n
i = 0
while i < n - 1:
	curr = seq[i:i + 2]
	if curr == 'RU' or curr == 'UR':
		res -= 1
		i += 2
	else:
		i += 1
print(res)


TN = 1

def solution():
	n = int(input())
	s = input()
	i = 1
	while i < len(s):
		if s[i - 1] + s[i] == 'UR' or s[i] + s[i - 1] == 'UR':
			s = s[:i - 1] + 'D' + s[i + 1:]
		i += 1
	print(len(s))
while TN != 0:
	solution()
	TN -= 1