Let's call (yet again) a string good if its length is even, and every character in odd position of this string is different from the next character (the first character is different from the second, the third is different from the fourth, and so on). For example, the strings good, string and xyyx are good strings, and the strings bad, aa and aabc are not good. Note that the empty string is considered good.

You are given a string $s$, you have to delete minimum number of characters from this string so that it becomes good.


-----Input-----

The first line contains one integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the number of characters in $s$.

The second line contains the string $s$, consisting of exactly $n$ lowercase Latin letters.


-----Output-----

In the first line, print one integer $k$ ($0 \le k \le n$) — the minimum number of characters you have to delete from $s$ to make it good.

In the second line, print the resulting string $s$. If it is empty, you may leave the second line blank, or not print it at all.


-----Examples-----
Input
4
good

Output
0
good

Input
4
aabc

Output
2
ab

Input
3
aaa

Output
3

Difficulty: EASY
Tags: Greedy algorithms
Skill types: Greedy algorithms

Starter code:

Solutions:
import sys
import collections
import math
import heapq
from operator import itemgetter

def getint():
	return int(input())

def getints():
	return [int(x) for x in input().split(' ')]
n = getint()
s = input()
r = []
for char in s:
	if len(r) % 2 == 0 or r[-1] != char:
		r.append(char)
if len(r) % 2 == 1:
	r.pop()
k = len(s) - len(r)
print(str(k))
print(''.join(r))


n = int(input())
s = list(input())
i = 0
j = 1
c = []
while j < n:
	if s[i] == s[j]:
		i = i + 1
		j = j + 1
	else:
		c.append(s[i])
		c.append(s[j])
		i = i + 2
		j = j + 2
print(n - len(c))
rs = ''.join(c)
print(rs)


n = int(input())
s = list(input())
if n == 1:
	print(1)
else:
	(i, j) = (0, 1)
	while i < n - 1 and j < n:
		if s[i] == s[j]:
			s[j] = ''
			j += 1
		else:
			i = j + 1
			j += 2
	res = ''.join((x for x in s))
	l = len(res)
	if l % 2 == 1:
		l -= 1
	print(n - l)
	print(res[:l])


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


def good_string(n, s):
	k = 0
	res = [''] * n
	for i in range(n):
		if i == 0:
			res[i] = s[i]
			k += 1
		elif k % 2 == 0:
			res[k] = s[i]
			k += 1
		elif s[i] != res[k - 1]:
			res[k] = s[i]
			k += 1
	if k % 2 == 1:
		k -= 1
	return (n - k, ''.join(res)[:k])
n = int(input())
s = input()
(k, res) = good_string(n, s)
print(k)
print(res)


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


n = int(input())
string = input()
pos = 0
rs = 0
s = 0
lst = []
while pos < n:
	nxt = pos + 1
	while nxt < n and string[nxt] == string[nxt - 1]:
		nxt += 1
	if nxt - pos == 1:
		s += 1
		lst.append(string[pos])
	if nxt - pos >= 2:
		rs += nxt - pos - 2
		if s % 2 == 0:
			rs += 1
			s += 1
			lst.append(string[pos])
		else:
			s += 2
			lst.append(string[pos])
			lst.append(string[pos])
	pos = nxt
lstrs = []
if (n - rs) % 2 == 1:
	rs += 1
	for i in range(len(lst) - 1):
		lstrs.append(lst[i])
else:
	for i in lst:
		lstrs.append(i)
print(rs)
print(''.join(lstrs))


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


n = int(input())
s = input() + 'K'
count = 0
ans = []
i = 0
while i < n:
	if s[i] == s[i + 1]:
		count += 1
		i += 1
	else:
		ans.append(s[i])
		ans.append(s[i + 1])
		i += 2
if ans[-1] == 'K':
	ans.pop()
	ans.pop()
	count += 1
print(count)
print(''.join(ans))


n = int(input())
s = input()
didx = set()
d = 0
l = 0
r = 1
while r < n:
	if s[l] != s[r]:
		l = r + 1
		r += 2
	else:
		d += 1
		didx.add(r)
		r += 1
if l != n:
	d += 1
	didx.add(l)
print(d)
print(''.join([c for (i, c) in enumerate(s) if i not in didx]))


n = int(input())
ans = []
IN = str(input())
pie = 1
ile = len(IN)
for i in range(0, n):
	if pie == 1:
		ans.append(i)
		pie = 0
	elif IN[i] != IN[ans[-1]]:
		ans.append(i)
		pie = 1
ost = len(ans)
if ost & 1 == 1:
	ost -= 1
ile -= ost
print(ile)
for i in range(0, ost):
	print(IN[ans[i]], end='')


n = int(input())
S = input()
k = ''
i = 0
while i < n - 1:
	if S[i] != S[i + 1]:
		k += S[i] + S[i + 1]
		i += 2
		continue
	i += 1
print(n - len(k))
print(k)


from sys import stdin
input = stdin.readline
n = int(input())
s = list(input().rstrip())
ans = []
flip = False
c = 0
for i in range(n - 1):
	if s[i] == s[i + 1] and (i % 2 == 0 and (not flip) or (i % 2 > 0 and flip)):
		c += 1
		flip = not flip
	else:
		ans.append(s[i])
ans.append(s[-1])
if len(ans) % 2 > 0:
	ans.pop()
	c += 1
print(c)
print(*ans, sep='')


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


n = int(input())
a = list(input())
(i, j) = (0, 1)
c = ''
while j < n:
	if a[i] == a[j]:
		j += 1
	else:
		c += a[i] + a[j]
		i = j + 1
		j += 2
print(n - len(c))
print(c)


import math
from collections import Counter
n = int(input())
l = list(input())
l = [' '] + l
r = []
count = 0
k = 0
i = 1
s = [0] * (n + 1)
while i < n:
	if (i + k) % 2 == 1:
		if l[i + 1] == l[i]:
			k += 1
			s[i] = 1
			count += 1
	i += 1
if (n - k) % 2 != 0:
	count += 1
print(count)
r = ''
for i in range(1, n + 1):
	if s[i] != 1:
		r = r + l[i]
if len(r) > 0:
	if (n - k) % 2 != 0:
		print(r[:-1])
	else:
		print(r)


import sys
n = int(input())
s = list(input())
ans = list()
if len(s) < 2:
	print(len(s))
	print()
	sys.exit()
i = iter(s)
current = next(i)
prev = current
current = next(i)
iteratedTwice = False
try:
	while current is not None:
		if prev != current:
			ans.append(prev)
			ans.append(current)
		else:
			while prev == current:
				prev = current
				current = next(i)
			ans.append(prev)
			ans.append(current)
		current = next(i)
		iteratedTwice = False
		prev = current
		current = next(i)
		iteratedTwice = True
except StopIteration:
	print(len(s) - len(ans))
	print(''.join(ans))


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


number = int(input())
word = input()
result = []
index = 0
for i in range(number):
	if index == 0:
		temp = word[i]
		index = 1
	else:
		if word[i] == temp:
			continue
		index = 0
	result.append(word[i])
if len(result) % 2 != 0:
	result = result[:len(result) - 1]
print(number - len(result))
for v in result:
	print(v, end='')


n = int(input())
ls = list(input())
i = c = 0
s = []
try:
	while i < n:
		while ls[i] == ls[i + 1]:
			(i, c) = (i + 1, c + 1)
		s.extend(ls[i:i + 2])
		i += 2
except IndexError:
	c += 1
print(c)
print(''.join(s))


n = int(input())
s = input()
a = []
for i in s:
	if len(a) % 2 == 0:
		a.append(i)
	elif a[-1] != i:
		a.append(i)
if len(a) % 2 == 1:
	a.pop()
print(n - len(a))
print(*a, sep='')


n = int(input())
a = []
a[:0] = input()
s = []
i = 0
while i + 1 < len(a):
	while i + 1 < len(a) and a[i] == a[i + 1]:
		i = i + 1
	if i + 1 < len(a):
		s.append(a[i])
		s.append(a[i + 1])
	i = i + 2
print(len(a) - len(s))
print(''.join(s))


n = int(input().split()[0])
string = input().split()[0]
goodstring = ''
count = 0
i = 0
while i < len(string):
	for j in range(i + 1, len(string)):
		if string[i] == string[j]:
			count = count + 1
			if j == len(string) - 1:
				count = count + 1
				i = len(string)
		else:
			goodstring = goodstring + string[i] + string[j]
			i = j + 1
			break
	if i == len(string) - 1:
		count = count + 1
		i = len(string)
print(count)
print(goodstring)


n = int(input())
s = list(input())
i = 0
while i < n:
	if i + 1 < n and s[i] == s[i + 1]:
		s[i] = ''
		i += 1
	else:
		i += 2
s = ''.join(s)
if len(s) % 2:
	s = s[:-1]
print(n - len(s))
print(s)


n = int(input())
s = list(input().strip())
start = 0
curr = 1
count = 0
while True:
	if curr >= n:
		break
	if s[start] == s[curr]:
		s[curr] = '0'
		curr += 1
	else:
		count += 1
		start = curr
		curr += 1
		if count % 2 != 0:
			start += 1
			curr += 1
			count += 1
s = list(filter(lambda x: x != '0', s))
if len(s) % 2 != 0:
	s = s[:-1]
print(n - len(s))
print(''.join(s))


n = int(input())
s = input()
res = ''
check = True
count = 0
for i in range(n):
	c = s[i]
	if check:
		if i + 1 < n:
			x = s[i + 1]
			if c == x:
				count += 1
			else:
				res += c
				check = False
		else:
			res += c
	else:
		res += c
		check = True
if len(res) % 2 == 0:
	print(count)
	print(res)
else:
	print(count + 1)
	print(res[0:len(res) - 1])


def getN():
	return int(input())

def getList():
	return list(map(int, input().split()))
n = getN()
s = input()
ans = 0
ansc = ''
ta = 0
tb = 1
while tb < n:
	(a, b) = (s[ta], s[tb])
	if a != b:
		ansc = ansc + a + b
		(ta, tb) = (tb + 1, tb + 2)
	else:
		ans += 1
		tb += 1
if ta <= n - 1 and tb > n - 1:
	ans += 1
print(ans)
print(ansc)


N = int(input())
ARR = input()
NEW_ARR1 = [ARR[0]]
lenlen = 1
for i in range(1, N):
	if lenlen % 2 != 1 or NEW_ARR1[-1] != ARR[i]:
		NEW_ARR1 += ARR[i]
		lenlen += 1
if lenlen % 2 == 0:
	print(N - lenlen)
	dd = ''
	for i in range(lenlen):
		dd += NEW_ARR1[i]
	print(dd)
else:
	print(N - (lenlen - 1))
	dd = ''
	for i in range(lenlen - 1):
		dd += NEW_ARR1[i]
	print(dd)


n = int(input())
a = input()
b = ''
for i in range(n):
	if len(b) % 2 == 0:
		b += a[i]
	elif a[i] != b[-1]:
		b += a[i]
print(n - len(b) + len(b) % 2)
print(b[:len(b) - len(b) % 2])


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


n = int(input())
s = list(input())
a = []
for i in range(len(s)):
	if len(a) % 2 == 0 or a[-1] != s[i]:
		a.append(s[i])
if len(a) % 2 == 0:
	print(len(s) - len(a))
	print(''.join(a))
else:
	a.pop()
	print(len(s) - len(a))
	print(''.join(a))


n = int(input())
s = input()
r = ''
full = True
for i in range(n):
	if full:
		r += s[i]
		full = False
	elif s[i] != s[i - 1]:
		r += s[i]
		full = True
if len(r) % 2 != 0:
	r = r[:-1]
print(len(s) - len(r))
print(r)


N = int(input())
s = input()
ANS = []
for i in range(N):
	if len(ANS) % 2 == 0 or ANS[-1] != s[i]:
		ANS += s[i]
if len(ANS) % 2:
	ANS = ANS[:-1]
print(N - len(ANS))
print(''.join(ANS))


n = int(input())
a = [x for x in input()]
ans = []
i = 0
j = 1
while i < n - 1 and j < n:
	if a[i] == a[j]:
		j += 1
	else:
		ans.append(a[i])
		ans.append(a[j])
		i = j + 1
		j += 2
print(n - len(ans))
if len(ans) % 2 == 0:
	print(''.join(ans))
else:
	print(''.join(ans[-1:]))


n = int(input())
string = input()
if not string:
	print(0)
	print('')
result = [string[0]]
c = 0
for i in range(1, n):
	if len(result) % 2 == 1 and string[i] == result[-1]:
		c += 1
	else:
		result.append(string[i])
if len(result) % 2 == 1:
	result.pop()
	c += 1
print(c)
print(''.join(result))


n = int(input())
s = list(input())
t = list()
i = 0
j = 1
while s != []:
	if i >= len(s) - 1 or j >= len(s):
		break
	if s[i] != s[j]:
		t.append(s[i])
		t.append(s[j])
		i = j + 1
	j += 1
print(n - len(t))
if t != []:
	print(''.join(t))


from collections import deque
n = int(input())
s = list(input())
t = deque()
if len(set(s)) == 1:
	print(n)
	exit()
else:
	res = deque()
	for i in range(n):
		if len(res) % 2 == 0 or res[-1] != s[i]:
			res.append(s[i])
	if len(res) % 2 != 0:
		res.pop()
	print(n - len(res))
	print(*res, sep='')


n = int(input())
s = input().strip()
prev = s[0]
ans = [s[0]]
k = 0
for i in range(1, n):
	if (k + i) % 2 == 1 and s[i] == prev:
		k += 1
		continue
	else:
		ans.append(s[i])
		prev = s[i]
if len(ans) % 2 == 1:
	ans.pop()
print(n - len(ans))
print(''.join(ans))


n = int(input())
s = input()
ans = ''
length = 0
for j in range(n):
	if not length & 1 or ans[length - 1] != s[j]:
		ans += s[j]
		length += 1
if length & 1:
	print(n - length + 1)
	print(ans[:length - 1])
else:
	print(n - length)
	print(ans)


n = int(input())
s = str(input())
r = s[0]
index = 0
for i in range(1, len(s)):
	if index % 2 == 0:
		if r[index] != s[i]:
			r = r + s[i]
			index += 1
	else:
		r = r + s[i]
		index += 1
if len(r) % 2 != 0:
	r = r[0:-1]
print(n - len(r))
print(r)


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


import sys
from bisect import bisect_left, bisect_right, insort
from collections import deque, Counter
from math import gcd, sqrt, factorial, ceil, log10, log2, floor
from itertools import permutations
from heapq import heappush, heappop, heapify
inf = float('inf')
mod = 1000000007

def factorial_p(n, p):
	ans = 1
	if n <= p // 2:
		for i in range(1, n + 1):
			ans = ans * i % p
	else:
		for i in range(1, p - n):
			ans = ans * i % p
		ans = pow(ans, p - 2, p)
		if n % 2 == 0:
			ans = p - ans
	return ans

def nCr_p(n, r, p):
	ans = 1
	while n != 0 or r != 0:
		(a, b) = (n % p, r % p)
		if a < b:
			return 0
		ans = ans * factorial_p(a, p) * pow(factorial_p(b, p), p - 2, p) * pow(factorial_p(a - b, p), p - 2, p) % p
		n //= p
		r //= p
	return ans

def prime_sieve(n):
	flag = n % 6 == 2
	sieve = bytearray((n // 3 + flag >> 3) + 1)
	for i in range(1, int(n ** 0.5) // 3 + 1):
		if not sieve[i >> 3] >> (i & 7) & 1:
			k = 3 * i + 1 | 1
			for j in range(k * k // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
			for j in range(k * (k - 2 * (i & 1) + 4) // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
	return sieve

def prime_list(n):
	res = []
	if n > 1:
		res.append(2)
	if n > 2:
		res.append(3)
	if n > 4:
		sieve = prime_sieve(n + 1)
		res.extend((3 * i + 1 | 1 for i in range(1, (n + 1) // 3 + (n % 6 == 1)) if not sieve[i >> 3] >> (i & 7) & 1))
	return res

def is_prime(n):
	if n < 5 or n & 1 == 0 or n % 3 == 0:
		return 2 <= n <= 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			p = p * p % n
			if p == n - 1:
				break
		else:
			return False
	return True

def all_factors(n):
	(small, large) = ([], [])
	for i in range(1, int(n ** 0.5) + 1, 2 if n & 1 else 1):
		if not n % i:
			small.append(i)
			large.append(n // i)
	if small[-1] == large[-1]:
		large.pop()
	large.reverse()
	small.extend(large)
	return small

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
string = input()
result = []
curr = 0
count = 0
for i in range(n):
	if curr == 0:
		result.append(string[i])
		curr = 1
	elif curr == 1:
		if result[-1] != string[i]:
			result.append(string[i])
			curr = 0
		else:
			count += 1
if len(result) % 2 == 0:
	print(count)
	print(''.join(result))
else:
	print(count + 1)
	result.pop()
	print(''.join(result))


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


import sys
import math
import collections
from pprint import pprint as pp
mod = 1000000007
MAX = 10 ** 10

def vector(size, val=0):
	vec = [val for i in range(size)]
	return vec

def matrix(rowNum, colNum, val=0):
	mat = []
	for i in range(rowNum):
		collumn = [val for j in range(colNum)]
		mat.append(collumn)
	return mat
(n, s) = (int(input()), input())
temp = ''
ans = 0
i = 0
while i < n - 1:
	if s[i] != s[i + 1]:
		temp += s[i] + s[i + 1]
		i += 2
	else:
		ans += 1
		i += 1
if i == n - 1:
	ans += 1
print(ans)
print(temp)


n = int(input())
s = input()
res = []
for c in s:
	if len(res) % 2 == 0 or res[-1] != c:
		res.append(c)
if len(res) % 2 == 1:
	res = res[0:-1]
print(n - len(res))
print(''.join(res))


N = int(input())
s = input()
if N == 0:
	print(0)
	print('')
else:
	res = ''
	d = 0
	first = 0
	second = 1
	while first < N and second < N:
		if s[first] != s[second]:
			d += second - first - 1
			res = res + s[first] + s[second]
			first = second + 1
			second = first + 1
		else:
			second += 1
	if first < N:
		d += N - first
	print(d)
	print(res)


n = int(input())
string = input()
ans = string[0]
count = 0
index = []
for q in range(1, n):
	if len(ans) % 2 == 1:
		if ans[-1] != string[q]:
			ans += string[q]
		else:
			count += 1
	else:
		ans += string[q]
if len(ans) % 2 != 0:
	print(count + 1)
	print(ans[:-1])
else:
	print(count)
	print(ans)


n = int(input())
st = input()
d = 0
i = 0
t = 1
es = ''
while i < n:
	cnt = 0
	if t % 2 == 1:
		j = i
		if j + 1 < n:
			while st[j + 1] == st[j]:
				cnt += 1
				j += 1
				if j + 1 > n - 1:
					break
	t += 1
	es += st[i]
	d += cnt
	i += cnt + 1
ess = es
if len(es) % 2 == 1:
	ess = es[:len(es) - 1]
print(d + len(es) - len(ess))
print(ess)


n = int(input())
a = input()
b = []
i = 0
while i < n - 1:
	if a[i] != a[i + 1]:
		b.append(a[i])
		b.append(a[i + 1])
		i = i + 2
	else:
		i = i + 1
if len(b) % 2 == 1:
	b.pop()
	ans += 1
c = ''.join(b)
print(n - len(b))
print(c)


n = int(input())
st = list(input())
s = []
i = 0
j = 1
while j < n:
	if st[i] == st[j]:
		j = j + 1
	else:
		s += st[i] + st[j]
		i = j + 1
		j = i + 1
print(n - len(s))
print(''.join(s))


n = int(input())
s = list(input())
if s == '':
	print(0)
	print()
else:
	cnt = 0
	stack = [s[0]]
	for i in range(1, n):
		if stack[len(stack) - 1] == s[i] and len(stack) % 2 == 1:
			cnt += 1
		else:
			stack.append(s[i])
	if len(stack) % 2 == 1:
		stack.pop()
		cnt += 1
	print(cnt)
	print(''.join(stack))


def solve():
	N = int(input())
	S = input()
	i = 0
	ans = []
	while i < N:
		ans.append(S[i])
		j = i + 1
		while j < N and S[i] == S[j]:
			j += 1
		i += j - i
		if i == N:
			break
		ans.append(S[i])
		i += 1
	if len(ans) % 2:
		ans.pop()
	print(N - len(ans))
	print(''.join(ans))
solve()


n = int(input())
a = list(input())
j = 1
fa = len(set(a))
for i in range(1, len(a)):
	if j == 1:
		if a[i - 1] == a[i]:
			a[i - 1] = ''
		else:
			j = 0
	else:
		j = 1
d = []
count = 0
for i in a:
	if i != '':
		d.append(i)
	else:
		count += 1
if j == 1:
	del d[len(d) - 1]
	count += 1
if fa == 1:
	count = n
print(count)
print(''.join((i for i in d)))


num = int(input())
st = input()
res = []
for i in range(len(st)):
	if len(res) % 2 == 0 or res[-1] != st[i]:
		res.append(st[i])
if len(res) % 2 == 1:
	res.pop()
print(num - len(res))
print(''.join(map(str, res)))


n = int(input())
s = list(input())
m = s
k = 0
j = 0
while j < n:
	if j == n - 1:
		m[j] = '0'
		k += 1
		break
	elif s[j] != s[j + 1]:
		j += 2
	else:
		m[j] = '0'
		k += 1
		j += 1
print(k)
for i in m:
	if i != '0':
		print(i, end='')


from sys import stdin, stdout

def input():
	return stdin.readline()[:-1]
import math
n = int(input())
s = list(input())
delete = [False] * n
count = 0
if n % 2 == 0:
	i = 0
	while i < n - 1:
		if s[i] == s[i + 1]:
			delete[i] = True
			count += 1
			i += 1
		else:
			i += 2
	if count % 2 == 1:
		i = n - 1
		while delete[i]:
			i -= 1
		delete[i] = True
		count += 1
else:
	adj_count_forward = [[0, 0] for i in range(n)]
	adj_count_backward = [[0, 0] for i in range(n)]
	for i in range(2, n):
		adj_count_forward[i][0] = adj_count_forward[i - 2][0] + (s[i - 2] == s[i - 1])
		if i - 3 >= 0:
			adj_count_forward[i][1] = adj_count_forward[i - 1][0]
	for i in range(n - 3, -1, -1):
		adj_count_backward[i][0] = adj_count_backward[i + 2][0] + (s[i + 2] == s[i + 1])
		if i + 3 < n:
			adj_count_backward[i][1] = adj_count_backward[i + 1][0]
	ind = 0
	tot = math.inf
	for i in range(n):
		if i % 2 == 0:
			if adj_count_forward[i][0] + adj_count_backward[i][0] < tot:
				ind = i
				tot = adj_count_forward[i][0] + adj_count_backward[i][0]
		elif adj_count_forward[i][1] + adj_count_backward[i][1] + (i + 1 < n and s[i - 1] == s[i + 1]) < tot:
			ind = i
			tot = adj_count_forward[i][1] + adj_count_backward[i][1]
	count += 1
	s.pop(ind)
	n -= 1
	i = 0
	while i < n - 1:
		if s[i] == s[i + 1]:
			delete[i] = True
			count += 1
			i += 1
		else:
			i += 2
	if count % 2 == 0:
		i = n - 1
		while delete[i]:
			i -= 1
		delete[i] = True
		count += 1
print(count)
for i in range(n - n % 2):
	if not delete[i]:
		print(s[i], end='')
print('')


import os
import sys
from io import BytesIO, IOBase
import math
from queue import Queue
import collections
import itertools
import bisect
import heapq
import random

def main():
	pass
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 binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

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

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	i = 2
	while i * i <= n:
		if primes[i] == True:
			for j in range(i * i, n + 1, i):
				primes[j] = False
		i += 1
	pr = []
	for i in range(0, n + 1):
		if primes[i]:
			pr.append(i)
	return pr

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac

def sod(n):
	s = 0
	while n > 0:
		s += n % 10
		n //= 10
	return s
n = int(input())
s = input()
i = 0
ans = []
while i < n:
	ci = len(ans)
	if ci % 2:
		ans.append(s[i])
		i += 1
	else:
		t = countcon(s, i)
		ans.append(s[i])
		i += t
if len(ans) % 2:
	ans.pop()
print(n - len(ans))
print(''.join(ans))


n = int(input())
s = input()
new = []
for i in range(0, n - 1, 2):
	if s[i] != s[i + 1]:
		if len(new) % 2 != 0:
			if s[i] != new[-1]:
				new.append(s[i])
				new.append(s[i + 1])
			elif s[i + 1] != new[-1]:
				new.append(s[i + 1])
		else:
			new.append(s[i])
			new.append(s[i + 1])
	elif len(new) % 2 != 0:
		if s[i] != new[-1]:
			new.append(s[i])
			new.append(s[i + 1])
		elif s[i + 1] != new[-1]:
			new.append(s[i + 1])
	else:
		new.append(s[i])
if n % 2 != 0 and len(new) > 0:
	if s[-1] != new[-1]:
		new.append(s[-1])
count = len(s) - len(new)
if len(new) % 2 != 0:
	new = new[:-1]
	count += 1
print(count)
print(''.join(new))


import sys
n = int(sys.stdin.readline().strip())
s = list(sys.stdin.readline().strip())
newstring = []
i = 0
numremoved = 0
while i < n - 1:
	if s[i] == s[i + 1]:
		i += 1
		numremoved += 1
	else:
		newstring.append(s[i])
		newstring.append(s[i + 1])
		i += 2
if i == n - 1:
	numremoved += 1
if len(newstring) % 2 == 1:
	numremoved += 1
	del newstring[-1]
totalstring = ''.join(newstring)
print(f'{numremoved}\n{totalstring}')


n = int(input())
s = input()
q = []
c = 0
flag = False
for i in range(n):
	if len(q) == 0:
		q.append(s[i])
	elif flag:
		q.append(s[i])
		flag = False
	elif q[-1] == s[i]:
		c = c + 1
	else:
		q.append(s[i])
		flag = True
if len(q) % 2 == 0:
	print(c)
else:
	print(c + 1)
	q.pop(-1)
for i in q:
	print(i, end='')


def good(list):
	(i, count) = (1, 0)
	rem = list[0]
	(k, z) = ([rem], True)
	while i < len(list):
		if z == False:
			k.append(list[i])
			rem = list[i]
			z = True
			i += 1
		elif list[i] == rem:
			i += 1
			count += 1
		else:
			k.append(list[i])
			i += 1
			z = False
	if len(k) % 2 != 0:
		k.pop()
		count += 1
	return (k, count)
n = int(input())
l = list(input())
y = good(l)
print(y[1])
if len(y[0]) == 0:
	pass
else:
	print(''.join((str(x) for x in y[0])))


n = int(input())
s = list(input().strip())
l = [1] * n
ct = 0
i = 0
while i < n - 1:
	j = i + 1
	if s[i] == s[i + 1]:
		while j < n and s[j] == s[i]:
			ct += 1
			l[j] = 0
			j += 1
	i = j + 1
	if i == n - 1:
		ct += 1
		l[-1] = 0
if l.count(1) % 2 == 0:
	print(ct)
	for i in range(n):
		if l[i] == 1:
			print(s[i], end='')
else:
	print(ct + 1)
	ind = l[::-1].index(1)
	for i in range(n - ind - 1):
		if l[i] == 1:
			print(s[i], end='')
print()


import io, sys, atexit, os
import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations
from itertools import combinations

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

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

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	gg = find_gcd(x, y)
	return x * y // gg
mm = 1000000007
yp = 0

def solve():
	t = 1
	for _ in range(t):
		n = nu()
		s = input()
		cc = 0
		last = ''
		xp = []
		for i in range(n):
			if len(xp) == 0:
				xp.append(s[i])
				continue
			if len(xp) % 2 == 0:
				xp.append(s[i])
				continue
			if xp[len(xp) - 1] == s[i]:
				continue
			xp.append(s[i])
			continue
		if len(xp) % 2 == 1:
			xp.pop(len(xp) - 1)
		print(n - len(xp))
		print(*xp, sep='')
solve()


n = int(input())
s = input()
res = ''
for i in range(n):
	if len(res) % 2 == 1 and res[-1] != s[i]:
		res += s[i]
	elif len(res) % 2 == 0:
		res += s[i]
if len(res) % 2 == 1:
	res = res[:-1]
print(n - len(res))
print(res)


n = int(input())
s = input()
(res, k, i) = ('', 0, 0)
while k < n:
	if i % 2 == 0:
		if k == n - 1:
			res += s[k]
			break
		if s[k] == s[k + 1]:
			res += s[k]
			i += 1
		else:
			res += s[k]
			res += s[k + 1]
			i += 2
		k += 2
	elif res[i - 1] == s[k]:
		k += 1
	else:
		res += s[k]
		i += 1
		k += 1
length = len(res)
if length % 2 == 1:
	res = res[:-1]
	length -= 1
print(n - length)
print(res)


n = int(input())
a = input()
l = []
p = 0
while 1:
	l.append(a[p])
	k = a[p]
	if p == n - 1:
		break
	for i in range(p + 1, n):
		if a[i] != k:
			l.append(a[i])
			p = i + 1
			break
	if i == n - 1:
		break
l = ''.join(l)
if len(l) % 2 != 0:
	l = l[0:len(l) - 1]
print(n - len(l))
print(l)


n = int(input())
s = input().strip()
a = ''
for i in range(n):
	if len(a) < 2 or a[-2:] != s[i] * 2:
		a += s[i]
b = ''
for i in range(len(a)):
	if len(b) & 1:
		if a[i] != b[-1]:
			b += a[i]
	else:
		b += a[i]
if len(b) & 1:
	b = b[:-1]
print(n - len(b))
print(b)


num = int(input())
s = input()
num2 = num
op = 0
i = 0
while s:
	if i >= num2 - 1:
		if num2 % 2 == 0:
			break
		s = s[:-1]
		num2 -= 1
		break
	k = 1
	while i + k < num2 and s[i] == s[i + k]:
		k += 1
	if k > 1:
		s = s[:i] + s[i + (k - 1):]
		num2 -= k - 1
	i += 2
print(num - num2)
print(s)


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import *
from itertools import *
import functools
import sys
from math import *
from decimal import *
from copy import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 10 ** 5 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

def numIN(x=' '):
	return map(int, sys.stdin.readline().strip().split(x))

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN():
	return list(numIN())

def dis(x, y):
	a = y[0] - x[0]
	b = x[1] - y[1]
	return (a * a + b * b) ** 0.5

def lgcd(a):
	g = a[0]
	for i in range(1, len(a)):
		g = math.gcd(g, a[i])
	return g

def ms(a):
	msf = -MAX
	meh = 0
	st = en = be = 0
	for i in range(len(a)):
		meh += a[i]
		if msf < meh:
			msf = meh
			st = be
			en = i
		if meh < 0:
			meh = 0
			be = i + 1
	return (msf, st, en)

def res(ans, t):
	print('Case #{}: {} {}'.format(t, ans[0], ans[1]))
n = int(input())
s = [i for i in input()]
f = 0
for i in range(n - 1):
	if i % 2 == f:
		if s[i] == s[i + 1]:
			s[i] = ''
			f = 1 - f
x = ''.join(s)
le = len(x)
if le % 2:
	print(n - (le - 1))
	print(x[:le - 1])
else:
	print(n - le)
	print(x)


import os
import sys
n = int(input())
s = input()
i = 0
ans = [s[0]]
for i in range(1, n):
	if len(ans) % 2 == 0 or ans[-1] != s[i]:
		ans.append(s[i])
if len(ans) % 2 == 1:
	ans.pop()
print(n - len(ans))
for x in ans:
	print(x, end='')


n = int(input())
s = list(input())
ans = 0
flag = False
if n == 1:
	print(1)
	print('')
else:
	for i in range(n - 1):
		if i % 2 == 0:
			if s[i] == s[i + 1]:
				break
	else:
		if n % 2 == 0:
			flag = True
			print(0)
			print(''.join(map(str, s)))
	if flag == False:
		s2 = []
		pos = 0
		l = 0
		cnt = 0
		for i in range(n - 1):
			if s[i] != s[i + 1]:
				cnt += 1
				s2.append(s[i])
				if pos == 1 and l != 1:
					cnt += 1
					s2.append(s[i])
				pos = cnt % 2
				l = 1
			else:
				l += 1
		if s[-2] != s[-1]:
			cnt += 1
			s2.append(s[-1])
		else:
			cnt += 1
			s2.append(s[-1])
			if pos == 1:
				cnt += 1
				s2.append(s[-1])
		if cnt % 2 == 0:
			print(n - len(s2))
			print(''.join(map(str, s2)))
		else:
			print(n - len(s2[:-1]))
			print(''.join(map(str, s2[:-1])))


n = int(input())
s = list(input())
k = 0
last = ''
is_even = False
for i in range(n):
	if is_even:
		if s[i] == last:
			k += 1
			s[i] = ''
			is_even = True
		else:
			is_even = False
			last = s[i]
	else:
		last = s[i]
		is_even = True
cnt = 0
for i in range(n):
	if s[i] != '':
		cnt += 1
if cnt % 2 == 1:
	k += 1
	for i in range(n - 1, -1, -1):
		if s[i] != '':
			s[i] = ''
			break
print(k)
print(''.join(s))


(n, s) = (int(input()), input())
(p1, p2, ans, l) = (0, 1, '', 0)
while p2 < n:
	if s[p1] == s[p2]:
		p2 += 1
	elif s[p1] != s[p2]:
		ans += s[p1] + s[p2]
		l += 2
		p2 += 2
		p1 = p2 - 1
print(n - l)
print(ans)


def main():
	n = int(input())
	s = input()
	s = ' ' + s
	s = s + ' '
	cx = [0 for i in range(n + 1000)]
	dec = 0
	for i in range(1, n + 1):
		if (i - dec) % 2 == 1 and s[i] == s[i + 1]:
			dec += 1
			cx[i] = 1
	if (n - dec) % 2 == 1:
		cx[n] = 1
		dec += 1
	print(dec)
	for i in range(1, n + 1):
		if cx[i] == 0:
			print(s[i], end='')
main()


n = int(input())
s = input()
res = ''
i = 0
while i < n:
	res += s[i]
	kk = 0
	lol = 0
	for k in range(i + 1, n):
		if s[i] != s[k]:
			res += s[k]
			i = k
			lol = 1
			break
	if lol == 0:
		i = n - 1
	i += 1
if len(res) % 2 == 1:
	res = res[:len(res) - 1]
print(n - len(res))
print(res)


n = int(input())
l = list(input())
res = ''
delete = 0
is_odd = n % 2
i = 0
j = 1
while j < n:
	while j < n and l[j] == l[i]:
		j += 1
	if j == n:
		break
	res += l[i]
	res += l[j]
	i = j + 1
	j = i + 1
if n == 1:
	print('1')
else:
	print(n - len(res))
	print(res)


n = int(input())
s = input()
ans = ''
last = ''
for i in s:
	if last == '':
		last = i
	elif last != i:
		ans += last
		ans += i
		last = ''
print(len(s) - len(ans))
print(ans)


class cinn:

	def __init__(self):
		self.x = []

	def cin(self, t=int):
		if len(self.x) == 0:
			a = input()
			self.x = a.split()
			self.x.reverse()
		return self.get(t)

	def get(self, t):
		return t(self.x.pop())

	def clist(self, n, t=int):
		l = [0] * n
		for i in range(n):
			l[i] = self.cin(t)
		return l

	def clist2(self, n, t1=int, t2=int, t3=int, tn=2):
		l = [0] * n
		for i in range(n):
			if tn == 2:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				l[i] = (a1, a2)
			elif tn == 3:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				a3 = self.cin(t3)
				l[i] = (a1, a2, a3)
		return l

	def clist3(self, n, t1=int, t2=int, t3=int):
		return self.clist2(self, n, t1, t2, t3, 3)

	def cout(self, i, ans=''):
		if ans == '':
			print('Case #' + str(i + 1) + ':', end=' ')
		else:
			print('Case #' + str(i + 1) + ':', ans)

	def printf(self, thing):
		print(thing, end='')

	def countlist(self, l, s=0, e=None):
		if e == None:
			e = len(l)
		dic = {}
		for el in range(s, e):
			if l[el] not in dic:
				dic[l[el]] = 1
			else:
				dic[l[el]] += 1
		return dic

	def talk(self, x):
		print(x, flush=True)

	def dp1(self, k):
		L = [-1] * k
		return L

	def dp2(self, k, kk):
		L = [-1] * k
		for i in range(k):
			L[i] = [-1] * kk
		return L
c = cinn()
n = c.cin()
tot = 0
s = list(c.cin(str))
flickr = 0
noo = []
for i in range(n):
	if i % 2 == flickr and i + 1 < n:
		if s[i] == s[i + 1]:
			tot += 1
			i += 1
			flickr = -flickr + 1
		else:
			noo.append(s[i])
	else:
		noo.append(s[i])
if len(noo) % 2:
	noo = noo[:-1]
	tot += 1
print(tot)
print(''.join(noo))


n = int(input())
s = list(input())
i = 0
j = 1
while j < len(s):
	while j < len(s) and s[i] == s[j]:
		s[j] = ''
		j += 1
	i = j + 1
	j += 2
if (len(s) - s.count('')) % 2 == 1:
	i = n - 1
	while i >= 0 and s[i] == '':
		i -= 1
	s[i] = ''
print(s.count(''))
print(''.join(s))


from collections import deque

def solve():
	n = int(input())
	s = deque(list(input()))
	remove_cnt = 0
	stock = []
	while len(s) >= 2:
		if s[0] != s[1]:
			x = s.popleft()
			y = s.popleft()
			stock.append(x)
			stock.append(y)
		elif s[0] == s[1]:
			re = s.popleft()
			remove_cnt += 1
			continue
	if s:
		remove_cnt += 1
	print(remove_cnt)
	print(''.join(stock))
	return

def main():
	t = 1
	for i in range(t):
		solve()
	return
main()


num = int(input())
s = input()
ss = ''
op = 0
i = 0
while i < num - 1:
	k = 1
	while i + k < num and s[i] == s[i + k]:
		k += 1
	if k > 1 and i + k == num:
		break
	ss += s[i] + s[i + k]
	i += k + 1
print(num - len(ss))
print(ss)


a = int(input())
b = input()
z = ''
i = 0
k = 0
while i < a:
	if k == 0:
		j = i
		while j < a and b[i] == b[j]:
			j += 1
		z += b[i]
		i = j
	else:
		z += b[i]
		i += 1
	k = (k + 1) % 2
if len(z) % 2:
	print(a - len(z) + 1)
	print(z[:-1])
else:
	print(a - len(z))
	print(z)


n = int(input())
s = list(input())
answer = []
for i in range(len(s)):
	if len(answer) == 0:
		answer.append(s[i])
	if answer[-1] != s[i] and len(answer) % 2 == 1:
		answer.append(s[i])
	elif len(answer) % 2 == 0:
		answer.append(s[i])
if len(answer) % 2 == 1:
	answer = answer[:-1]
print(len(s) - len(answer))
print(''.join(answer))


numero = int(input())
palavra = input()
vetorPalavra = []
for i in range(len(palavra)):
	vetorPalavra.append(0)
apontador = 0
contador = 0
i = 1
while True:
	if apontador + i > len(palavra) - 1:
		break
	if palavra[apontador] == palavra[apontador + i]:
		contador += 1
		vetorPalavra[apontador + i] = -1
		i += 1
	else:
		apontador += i + 1
		i = 1
paridade = len(palavra) - contador
if paridade % 2 != 0:
	contador += 1
	print(contador)
	for i in range(len(palavra) - 1, -1, -1):
		if vetorPalavra[i] == 0:
			vetorPalavra[i] = -1
			break
	for i in range(len(palavra)):
		if vetorPalavra[i] == 0:
			print(palavra[i], end='')
	print('')
else:
	print(contador)
	for i in range(len(palavra)):
		if vetorPalavra[i] == 0:
			print(palavra[i], end='')
	print('')


N = int(input())
S = input()
ans = 0
res = ''
i = 0
while i < N:
	if i < N - 1 and S[i] != S[i + 1]:
		res += S[i]
		res += S[i + 1]
		i += 2
	elif i < N - 2 and S[i + 1] != S[i + 2]:
		res += S[i + 1]
		res += S[i + 2]
		ans += 1
		i += 3
	else:
		ans += 1
		i += 1
print(ans)
print(res)


n = int(input())
c = None
r = 0
rr = []
for v in input():
	if not c:
		c = v
		rr.append(v)
	elif c != v:
		r += 1
		rr.append(v)
		c = None
print(n - 2 * r)
print(''.join(rr[:2 * r]))


n = int(input())
s = input()
ans = []
k = 0
for i in range(n - 1):
	if s[i] == s[i + 1] and (i + k) % 2 == 0:
		k = (k + 1) % 2
	else:
		ans.append(s[i])
if len(ans) % 2 == 1:
	ans.append(s[-1])
print(len(s) - len(ans))
print(''.join(ans))


import os
import heapq
import sys, threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10 ** 5)
from io import BytesIO, IOBase

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

def power(x, p, m):
	res = 1
	while p:
		if p & 1:
			res = res * x % m
		x = x * x % m
		p >>= 1
	return res

def inar():
	return [int(k) for k in input().split()]

def lcm(num1, num2):
	return num1 * num2 // gcd(num1, num2)

def main():
	t = 1
	for _ in range(t):
		n = int(input())
		st = input()
		ans = []
		for i in range(n):
			if len(ans) % 2 == 0:
				ans.append(st[i])
			elif st[i] != ans[-1]:
				ans.append(st[i])
		if len(ans) % 2 != 0:
			nu = len(ans)
			ans = ans[0:nu - 1]
			print(n - len(ans))
			print(''.join(ans))
		else:
			print(n - len(ans))
			print(''.join(ans))
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')
main()


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
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 list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

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

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

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

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

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

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = 1
	rr = []
	for _ in range(t):
		n = I()
		s = S()
		r = []
		f = 1
		for c in s:
			if f or r[-1] != c:
				r.append(c)
				f ^= 1
		if len(r) % 2 == 1:
			r = r[:-1]
		rr.append(n - len(r))
		rr.append(JA(r, ''))
	return JA(rr, '\n')
print(main())


n = int(input())
s = []
i = 0
j = 1
a = input()
while j < n:
	if a[i] == a[j]:
		j += 1
	else:
		s += a[i] + a[j]
		i = j + 1
		j += 2
print(n - len(s))
print(''.join(s))


n = int(input())
s = input()
t = 0
pre = s[0]
ans = ''
v = 0
for i in range(n):
	if s[i] == pre:
		t += 1
	else:
		if v % 2 == 0:
			ans += pre
			v += 1
		else:
			ans += pre * min(2, t)
			v += min(2, t)
		pre = s[i]
		t = 1
if v % 2 == 1 and t >= 1:
	ans += s[-1]
	v += 1
print(n - v)
print(ans)


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
lens = RI()
strs = RW()
valids = ''
left = 0
rite = 1
while rite < lens:
	if strs[left] != strs[rite]:
		valids += strs[left] + strs[rite]
		left = rite + 1
		rite += 2
	else:
		rite += 1
print(lens - len(valids))
print(valids)


n = int(input())
arr = input()
ans = str()
ans += arr[0]
k = 1
u = 0
for i in range(1, n):
	if k % 2 == 0:
		ans += arr[i]
		k += 1
	elif arr[i] != ans[-1]:
		ans += arr[i]
		k += 1
	else:
		u += 1
if len(ans) % 2 != 0:
	print(u + 1)
	print(ans[:-1])
else:
	print(u)
	print(ans)


t = int(input())
s = input()
a = ''
i = 0
while i < t - 1:
	if s[i] == s[i + 1]:
		i += 1
		continue
	a = a + s[i] + s[i + 1]
	i += 2
print(t - len(a))
print(a)


n = int(input())
q = input()
k = 0
i = 0
ki = 0
while i <= n - k - 1:
	w = i
	while w <= n - k - 2 and q[i] == q[w + 1]:
		w += 1
		ki += 1
	if w != i:
		k += ki
		ki = 0
		q = q[:i] + q[w:]
	i += 2
if len(q) % 2 != 0:
	k += 1
	q = q[:-1]
print(k)
print(q)


n = int(input())
a = input()
s = a[0]
k = 1
for i in range(1, n):
	if k % 2 == 1 and a[i] != s[-1]:
		s += a[i]
		k += 1
	elif k % 2 == 0:
		s += a[i]
		k += 1
if len(s) % 2 == 1:
	s = s[:len(s) - 1]
print(len(a) - len(s))
print(s)


n = int(input())
st = list(input())
x = []
y = []
cur = st[0]
num = 1
for i in range(1, n):
	if st[i] == cur:
		num += 1
	else:
		x.append(cur)
		y.append(num)
		cur = st[i]
		num = 1
x.append(cur)
y.append(num)
start = 0
for j in range(len(y)):
	if start % 2 == 1:
		if y[j] == 1:
			start += 1
		else:
			y[j] = 2
			start += 2
	else:
		y[j] = 1
		start += 1
if start % 2 == 0:
	print(n - start)
	for i in range(len(x)):
		for j in range(y[i]):
			print(x[i], end='')
else:
	if y[j] == 1:
		k = len(x) - 1
	else:
		k = len(x)
		y[k - 1] = 1
	print(n - start + 1)
	for i in range(k):
		for j in range(y[i]):
			print(x[i], end='')


b = int(input())
a = input()
s = [a[0]]
for i in range(1, b):
	if a[i] != s[-1] or len(s) % 2 == 0:
		s.append(a[i])
if len(s) % 2:
	s.pop()
print(b - len(s))
print(''.join(s))


n = int(input())
s = input()
res = []
i = 0
ops = 0
while i < n:
	if i + 1 == n or s[i] == s[i + 1]:
		ops += 1
		i += 1
	else:
		res += [s[i], s[i + 1]]
		i += 2
print(ops)
print(''.join(res))


from sys import setcheckinterval, stdin
setcheckinterval(1000)
iin = lambda : int(stdin.readline())
lin = lambda : list(map(int, stdin.readline().split()))
n = iin()
a = input()
ch = 0
ans = []
dlt = 0
i = 0
while i < n:
	if ch % 2 == 0:
		try:
			if a[i] != a[i + 1]:
				ch += 1
				ans.append(a[i])
			else:
				dlt += 1
		except:
			if ch and ans[-1] != a[i]:
				ans.append(a[i])
			else:
				dlt += 1
	else:
		ch += 1
		ans.append(a[i])
	i += 1
if len(ans) % 2:
	dlt += 1
	ans.pop()
print(dlt)
print(''.join(ans))


n = int(input())
s = input()
dp = [() for i in range(n)]
dp[0] = (s[0], 1)
ans = 0
res = [s[0]]
for i in range(1, n):
	if dp[i - 1][1] % 2 == 1 and dp[i - 1][0] == s[i]:
		ans += 1
		dp[i] = (dp[i - 1][0], dp[i - 1][1])
	else:
		dp[i] = (s[i], dp[i - 1][1] + 1)
		res.append(s[i])
if dp[n - 1][1] % 2 == 1:
	ans += 1
	lr = len(res)
	res.pop(lr - 1)
print(ans)
print(''.join(res))


n = int(input())
s = input()
l1 = []
for c in s:
	if len(l1) == 0:
		l1.append(c)
	elif len(l1) % 2 == 1:
		if l1[-1] == c:
			continue
		else:
			l1.append(c)
	else:
		l1.append(c)
if len(l1) % 2 == 0:
	print(n - len(l1))
	print(''.join(l1))
else:
	print(n - len(l1) + 1)
	print(''.join((str(l1[i]) for i in range(0, len(l1) - 1))))


n = int(input())
s = list(input().strip())
ops = 0
i = 0
newS = ''
while i < n - 1:
	if s[i] != s[i + 1]:
		newS += s[i] + s[i + 1]
		i += 2
	else:
		ops += 1
		i += 1
if (n - ops) % 2 == 1:
	newS += s[-1]
if len(newS) % 2 == 1:
	newS = newS[:len(newS) - 1]
	ops += 1
print(ops)
print(newS)


n = int(input())
s = input().rstrip()
x = list(s)
D = 0
if len(x) % 2 == 0:
	if len(x) % 2 == 0:
		l = []
		q = []
		i = 0
		while i < len(x) - 1:
			if x[i] == x[i + 1]:
				i += 1
				D += 1
			else:
				l.append(x[i])
				l.append(x[i + 1])
				q.append(i)
				q.append(i + 1)
				i += 2
		if len(q) == 0 or q[len(q) - 1] != n - 1:
			l.append(x[len(x) - 1])
		if len(l) > 1 and l[len(l) - 1] == l[len(l) - 2]:
			del l[len(l) - 1]
			D += 1
		if len(l) % 2 != 0:
			D += 1
			del l[len(l) - 1]
		print(D)
		if len(l) != 0:
			print(''.join(l))
		else:
			print()
elif n % 2 != 0:
	D = 0
	l = []
	q = []
	i = 0
	while i < len(x) - 1:
		if x[i] == x[i + 1]:
			i += 1
			D += 1
		else:
			l.append(x[i])
			l.append(x[i + 1])
			q.append(i)
			q.append(i + 1)
			i += 2
	if len(q) == 0 or q[len(q) - 1] != n - 1:
		l.append(x[len(x) - 1])
	if len(l) > 1 and l[len(l) - 1] == l[len(l) - 2]:
		del l[len(l) - 1]
		D += 1
	if len(l) % 2 != 0:
		D += 1
		del l[len(l) - 1]
	print(D)
	if len(l) != 0:
		print(''.join(l))
	else:
		print()


def disp(s):
	for c in s:
		if c != ' ':
			print(c, end='')
	print('')

def main():
	n = int(input())
	s = [i for i in input()]
	ans = 0
	for i in range(len(s)):
		if (i - ans) % 2 == 0 and i < len(s) - 1 and (s[i] == s[i + 1]):
			s[i] = ' '
			ans += 1
		elif i + 1 == len(s) and len(s) - ans & 1:
			s[i] = ' '
			ans += 1
	print(ans)
	disp(s)
main()


n = int(input())
s = input()
j = 0
c = 0
t = 1
s1 = ''
if n == 1:
	print(1)
else:
	while t:
		if s[j] != s[j + 1]:
			s1 = s1 + s[j]
			s1 = s1 + s[j + 1]
			j = j + 2
		else:
			j = j + 1
		if j >= len(s) - 1:
			break
	print(len(s) - len(s1))
	print(s1)


def solve(string):
	deleted = set()
	current_idx = -1
	current = ''
	for (i, c) in enumerate(string):
		if current == '':
			current = c
			current_idx = i
		elif current == c:
			deleted.add(i)
		else:
			current = ''
			current_idx = -1
	if current != '':
		deleted.add(current_idx)
	result = ''.join([string[i] for i in range(len(string)) if i not in deleted])
	print(len(deleted))
	print(result)
n = int(input())
string = input()
solve(string)


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


n = int(input())
s = input()
res = ''
for i in s:
	if len(res) % 2 == 0 or res[len(res) - 1] != i:
		res += i
if len(res) % 2 == 1:
	res = res[0:len(res) - 1]
print(n - len(res))
print(res)


n = int(input())
t = []
k = 0
for c in input():
	if k:
		if c == t[-1]:
			continue
		else:
			t.append(c)
			k = 0
	else:
		t.append(c)
		k = 1
if len(t) % 2:
	t = t[:-1]
print(n - len(t))
print(''.join(t))


n = int(input())
string = input()
array = []
ans = ''
for i in range(len(string)):
	if len(ans) % 2 == 0:
		ans += string[i]
	elif ans[-1] != string[i]:
		ans += string[i]
if len(ans) % 2:
	print(len(string) - len(ans) + 1)
	print(ans[:-1])
else:
	print(len(string) - len(ans))
	print(ans)


import sys
import math

def main():
	n = int(sys.stdin.readline().strip())
	s = sys.stdin.readline().strip()
	ans = ''
	last = ''
	for i in s:
		if last == '':
			last = i
		elif last != i:
			ans += last
			ans += i
			last = ''
	print(len(s) - len(ans))
	print(ans)
main()


n = int(input())
s = input()
res = []
for i in s:
	if len(res) & 1 == 0 or i != res[-1]:
		res.append(i)
if len(res) & 1:
	res.pop()
print(n - len(res))
print(''.join(res))


n = int(input())
S = input()
from collections import deque
QUE = deque(S)
ANS = []
while QUE:
	if len(QUE) == 1:
		QUE.pop()
		break
	if QUE[0] == QUE[1]:
		QUE.popleft()
	elif QUE[0] != QUE[1]:
		x = QUE.popleft()
		y = QUE.popleft()
		ANS.append(x)
		ANS.append(y)
print(n - len(ANS))
print(''.join(ANS))


n = int(input())
s = input()
length = 0
ans = [None] * n
for i in range(n):
	check = length % 2 == 1
	if check:
		if s[i] != ans[length - 1]:
			ans[length] = s[i]
			length += 1
	else:
		ans[length] = s[i]
		length += 1
if length % 2 != 0:
	length -= 1
print(n - length)
print(''.join(ans[:length]))


n = int(input())
s = input()
stack = [s[0]]
i = 0
op = 0
for j in range(1, n):
	stack.append(s[j])
	try:
		if stack[i] and stack[i + 1]:
			if stack[i] == stack[i + 1]:
				stack.pop()
				op += 1
			else:
				i += 2
	except:
		pass
if len(stack) % 2 == 1:
	stack.pop()
	op += 1
print(op)
print(''.join(stack))


n = int(input())
s = input()
st = []
c = 0
l = 0
for i in s:
	if not st:
		st.append(i)
		l += 1
	elif l % 2 == 1:
		if st[-1] == i:
			c += 1
		else:
			st.append(i)
			l += 1
	else:
		st.append(i)
		l += 1
if len(st) % 2 == 1:
	st.pop(-1)
	c += 1
print(c)
print(''.join(st))


num = int(input())
s = input()
ln = len(s)
new = ''
for char in s:
	if not new or len(new) % 2 == 0 or new[-1] != char:
		new += char
if len(new) % 2 != 0:
	new = new[:-1]
print(num - len(new))
print(new)


n = int(input())
s = input()
temp = 0
result = 0
idx = 0
result_str = ''
actual_idx = 0
while idx <= len(s) - 1:
	if actual_idx % 2 != 0:
		result_str += s[idx]
	elif idx + 1 < len(s) and s[idx] == s[idx + 1]:
		result += 1
		actual_idx -= 1
	else:
		result_str += s[idx]
	actual_idx += 1
	idx += 1
if len(result_str) % 2 != 0:
	result += 1
	result_str = result_str[:-1]
print(result)
print(result_str)


n = int(input())
s = input()
dels = 0
res = s[0:1]
for c in s[1:]:
	if len(res) % 2 and res[-1] == c:
		dels += 1
	else:
		res += c
if len(res) % 2:
	res = res[:-1]
	dels += 1
print(dels)
print(res)


from collections import defaultdict as ddic, Counter, deque
from itertools import permutations

def ipt():
	return int(input())

def iptl():
	return list(map(int, input().split()))
MOD = 10 ** 9 + 7

def main():
	N = ipt()
	S = input()
	ans = []
	for x in S:
		if not ans or len(ans) % 2 == 0 or ans[-1] != x:
			ans.append(x)
	if len(ans) % 2:
		ans.pop()
	ans1 = (N - len(ans), ''.join(ans))
	print(ans1[0])
	print(ans1[1])
main()


import sys
input = sys.stdin.readline
n = int(input())
s = input().strip()
ans = []
x = 0
for c in s:
	if x & 1:
		if c == ans[-1]:
			continue
		else:
			ans.append(c)
			x += 1
	else:
		ans.append(c)
		x += 1
if x & 1:
	print(n - x + 1)
	print(''.join(ans[:-1]))
else:
	print(n - x)
	print(''.join(ans))


n = int(input())
s = input()
d = []
(i, j) = (0, 1)
while j < n:
	if s[i] == s[j]:
		j += 1
	else:
		d.append(s[i])
		d.append(s[j])
		i = j + 1
		j += 2
print(n - len(d))
print(''.join(d))


n = int(input())
l = list(input())
mask = [0] * n
cnt = 0
for i in range(1, n):
	if mask[i - 1] == 1:
		if l[i] == l[i - 1]:
			mask[i] = 1
			cnt += 1
	elif l[i] == l[i - 1] and (i - cnt) % 2 == 1:
		mask[i] = 1
		cnt += 1
st = []
for i in range(n):
	if mask[i] == 0:
		st.append(l[i])
if len(st) % 2 == 1:
	st.pop()
	cnt += 1
print(cnt)
print(''.join(st))


n = int(input())
st = input()
new_s = ''
i = 0
while i < n - 1:
	if st[i] == st[i + 1]:
		i += 1
	else:
		new_s += st[i:i + 2]
		i += 2
print(len(st) - len(new_s))
print(new_s)


n = int(input())
a = list(input())
i = 1
ans = 0
b = [a[0]]
l = 1
while i < n:
	if a[i] == b[-1]:
		ans += 1
		i += 1
	else:
		b.append(a[i])
		i += 1
		l += 1
		if i == n:
			break
		b.append(a[i])
		i += 1
		l += 1
if l % 2 == 1:
	b.pop(-1)
	ans += 1
print(ans)
print(''.join(b))


IN = input
rint = lambda : int(IN())
rmint = lambda : map(int, IN().split())
rlist = lambda : list(rmint())
n = rint()
h = IN()
s = ['*'] * n
z = 0
for c in h:
	if z < 2 or s[z - 2] != c or s[z - 1] != c:
		s[z] = c
		z += 1
n = z
s.append('#')
mk = [0] * n
t = 0
for i in range(n):
	if i & 1:
		continue
	if i + t + 1 >= n:
		break
	if s[i + t + 1] == s[i + t]:
		mk[i + t] = 1
		t = 1 - t
t = [s[i] for i in range(n) if not mk[i]]
n = len(t)
if n & 1:
	t = t[:-1]
print(len(h) - len(t))
for o in t:
	print(o, end='')


n = int(input())
s = list(input())
ans = 0
i = 0
c = 0
while i < len(s) - 1:
	if s[i] == s[i + 1] and i % 2 == c:
		s[i] = '-'
		ans += 1
		c = (1 + c) % 2
	else:
		i += 1
s_new = ''
for i in range(len(s)):
	if s[i] != '-':
		s_new += s[i]
if len(s_new) % 2 == 1:
	ans += 1
	s_new = s_new[:-1]
print(ans, s_new, sep='\n')


n = int(input())
s = input()
r = 0
i = 0
t = [s[0]]
for c in s[1:]:
	if len(t) % 2 == 1:
		if c == t[-1]:
			continue
	t.append(c)
if len(t) % 2 == 1:
	t.pop()
print(len(s) - len(t))
print(''.join(t))


n = int(input())
s = list(input())
i = 0
j = 0
final = []
for i in range(len(s)):
	if not final:
		final.append(s[i])
	elif len(final) % 2 == 0 or final[-1] != s[i]:
		final.append(s[i])
if len(final) % 2 == 0:
	print(n - len(final))
	print(''.join(final))
else:
	final.pop()
	print(n - len(final))
	print(''.join(final))


def bul(a):
	a = (a + 1) % 2
	return a
d = input()
oldstrok = input()
kol = 0
chet = 0
if len(oldstrok) == 0:
	print(0)
else:
	last = oldstrok[0]
	newStrok = ''
	for i in range(0, len(oldstrok)):
		sled = oldstrok[i]
		if sled == last and chet == 1:
			kol = kol + 1
			last = sled
		else:
			chet = bul(chet)
			newStrok = newStrok + sled
			last = sled
	if len(newStrok) % 2 == 1:
		newStrok = newStrok[:len(newStrok) - 1]
		kol = kol + 1
	print(kol)
	print(newStrok)


n = int(input())
s = input()
ans = ''
la = 0
for i in range(n):
	if la % 2 == 0:
		ans += s[i]
		la += 1
	elif ans[-1] != s[i]:
		ans += s[i]
		la += 1
print(n - len(ans) + int(len(ans) % 2 == 1))
print(ans if len(ans) % 2 == 0 else ans[:-1])


ln = int(input()) - 1
i = 0
word = list(input())
while i < ln:
	if word[i] == word[i + 1]:
		word[i] = ''
		i += 1
	else:
		i += 2
ret = ''.join(word)
if len(ret) % 2 == 1:
	ret = ret[:-1]
print(ln + 1 - len(ret))
print(ret)


import sys
input = sys.stdin.readline
n = int(input())
s = list(input())
if n == 0:
	print('0\n')
r = [s[0]]
for i in range(1, n):
	if len(r) % 2 == 0 or r[-1] != s[i]:
		r += s[i]
if len(r) % 2 == 1:
	r.pop()
print(n - len(r), '\n{}'.format(''.join(r)))


from math import sqrt, ceil, floor, gcd, factorial
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
import string
import bisect

def solve():
	n = int(input())
	a = list(input())
	ans = []
	i = 0
	o = 0
	while i < n:
		tmp = a[i]
		f = False
		for j in range(i + 1, n):
			if a[j] != tmp:
				f = True
				break
		if not f:
			break
		ans.append(tmp)
		ans.append(a[j])
		i = j + 1
	print(n - len(ans))
	print(''.join(ans))
solve()


n = int(input())
s = input()
s = list(s)
l = []
i = 0
while i < n - 1:
	if s[i] != s[i + 1]:
		l.append(s[i])
		l.append(s[i + 1])
		i = i + 2
	else:
		l.append(s[i])
		z = s[i + 1]
		flag = 0
		j = i + 2
		for j in range(i + 2, n):
			if s[j] == z:
				continue
			else:
				l.append(s[j])
				break
		i = j + 1
if len(l) % 2 != 0:
	print(n - len(l) + 1)
	for i in range(len(l) - 1):
		print(l[i], end='')
else:
	print(n - len(l))
	for i in range(len(l)):
		print(l[i], end='')


from sys import stdin
input = stdin.readline
n = int(input())
s = input()
num_res = 0
s_res = [''] * n
i = 0
while i < n - 1:
	if s[i] != s[i + 1]:
		s_res[i - num_res] = s[i]
		s_res[i + 1 - num_res] = s[i + 1]
		i += 2
	else:
		s_act = s[i]
		i += 1
		while i < n and s_act == s[i]:
			i += 1
			num_res += 1
		if i != n:
			(s_res[i - num_res - 1], s_res[i - num_res]) = (s_act, s[i])
			i += 1
		else:
			num_res += 1
if i == n - 1:
	num_res += 1
print(num_res)
print(''.join(s_res))


import sys
n = int(input())
string = input()
if n == 0:
	print('0\n')
	sys.exit()
answer = []
i = 0
changes = 0
last_letter = ''
while i < n:
	if len(answer) % 2 == 0 or string[i] != last_letter:
		answer.append(string[i])
		last_letter = string[i]
	else:
		changes += 1
	i += 1
if len(answer) % 2 == 1:
	answer.pop()
	changes += 1
print(changes)
print(''.join(answer))


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


def main(k):
	k = list(k)
	if len(list(set(k))) == 1:
		a = [len(k)]
		return a
	index = 1
	count = 0
	while index < len(k):
		if k[index - 1] == k[index]:
			count = count + 1
			del k[index - 1]
		else:
			index = index + 2
	if len(k) % 2 != 0:
		count = count + 1
		del k[len(k) - 1]
	a = []
	a.append(count)
	a.append(''.join(map(str, k)))
	return a
n = int(input())
k = input()
res = main(k)
index = 0
while index < len(res):
	if index == 0:
		print(int(res[index]))
	else:
		print(res[index])
	index = index + 1


n = int(input())
s = str(input())
p = []
cnt = n
i = 0
while i < n - 1:
	if s[i] != s[i + 1]:
		cnt -= 2
		p.append(s[i])
		p.append(s[i + 1])
		i += 1
	i += 1
print(cnt)
print(''.join(p))


n = int(input())
st = input().rstrip()
newSt = [st[0]]
p = 1
dele = 0
cmp = True
brk = False
while True:
	if p + 1 > len(st):
		break
	if cmp:
		while newSt[-1] == st[p]:
			p += 1
			dele += 1
			if p + 1 > len(st):
				brk = True
				break
		if brk:
			break
		newSt.append(st[p])
		p += 1
		cmp = False
	else:
		newSt.append(st[p])
		p += 1
		cmp = True
if len(newSt) % 2 == 1:
	newSt.pop()
	dele += 1
print(dele)
print(*newSt, sep='')


n = int(input())
s = input()
dels = 0
res = s[0:1]
for i in range(1, len(s)):
	if len(res) % 2 and res[-1] == s[i]:
		dels += 1
	else:
		res += s[i]
if len(res) % 2:
	res = res[:-1]
	dels += 1
print(dels)
print(res)


n = int(input())
s = list(input())
ans = []
for i in s:
	if not ans or len(ans) % 2 == 0 or ans[-1] != i:
		ans.append(i)
if len(ans) % 2:
	ans.pop()
print(n - len(ans))
print(''.join(ans))


(n, s) = (int(input()), list(input()))
last = s[0]
i = 1
while i < n:
	if s[i] == last:
		s[i] = ''
	else:
		i += 1
		if i < n:
			last = s[i]
	i += 1
ans = ''.join(s)
if len(ans) % 2 == 1:
	ans = ans[:-1]
print(len(s) - len(ans), '\n', ans, sep='')


n = int(input())
s = input()
ans = ''
v = [0] * n
flag = True
for i in range(n - 1):
	if flag:
		if s[i] == s[i + 1]:
			v[i] = 1
		else:
			flag = False
	else:
		flag = not flag
for i in range(n):
	if v[i] == 0:
		ans += s[i]
if len(ans) % 2:
	ans = ans[:-1]
print(n - len(ans))
print(ans)


n = int(input())
s = list(input())
c = 0
f = 1
for i in range(n - 1):
	if f == 1:
		if s[i] == s[i + 1]:
			s[i] = '0'
			c += 1
		else:
			f = 0
	else:
		f = 1
s = ''.join(s)
s = s.replace('0', '')
if len(s) % 2 == 1:
	print(c + 1)
	print(s[:len(s) - 1])
else:
	print(c)
	print(s)


def strtoint(string):
	try:
		integer = int(string)
		return integer
	except ValueError:
		print('Value not integer!')
		exit()

def tochararray(string):
	chars = []
	for char in string:
		chars.append(char)
	return chars

def tostr(array):
	string = ''
	for char in array:
		string += char
	return string

def makegood(array: list):
	keep = []
	i = 0
	diff = 1
	while i < len(array):
		if i + diff < len(array):
			if array[i] != array[i + diff]:
				keep.append(array[i])
				keep.append(array[i + diff])
				i += diff + 1
				diff = 1
			else:
				diff += 1
		else:
			i += 1
	return [len(array) - len(keep), keep]
length = strtoint(input(''))
wordstr = input('')
word = tochararray(wordstr)
results = makegood(word)
print(results[0])
print(tostr(results[1]))


import sys
import math
n = int(sys.stdin.readline())
s = list(sys.stdin.readline())
s.pop()
ans = ''
for i in range(n):
	if len(ans) % 2 == 0:
		ans += s[i]
	elif s[i] != ans[-1]:
		ans += s[i]
if len(ans) % 2 != 0:
	a = ans[:-1]
	print(len(s) - len(a))
	print(a)
else:
	print(len(s) - len(ans))
	print(ans)


n = int(input())
ar = input()
ar = list(ar)
count = 0
index = dict()
i = 0
j = 1
t = n
while j < n:
	if ar[i] == ar[j]:
		index[j] = True
		count += 1
		j += 1
	else:
		i = j + 1
		j = i + 1
newString = ''
for i in range(n):
	if i in index:
		continue
	else:
		newString += ar[i]
if len(newString) % 2 != 0:
	count += 1
	print(count)
	print(newString[:len(newString) - 1])
else:
	print(count)
	print(newString)


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


t = int(input(''))
s = input('')
a = []
b = []
for i in range(t):
	a.append(s[i])
j = -1
while j < t - 1:
	j += 1
	b.append(s[j])
	for k in range(j + 1, t):
		if s[k] == b[-1]:
			j = k
			continue
		else:
			b.append(s[k])
			j = k
			break
if len(b) % 2 == 0:
	print(t - len(b))
	for i in range(len(b)):
		print(b[i], end='')
else:
	print(t - len(b) + 1)
	for i in range(len(b) - 1):
		print(b[i], end='')


n = int(input())
s = input()
nl = []
k = 1
nl.append(1)
for i in range(0, len(s) - 1):
	if s[i] == s[i + 1] and nl[i] % 2 == 1:
		nl.append(nl[i])
	else:
		nl.append(nl[i] + 1)
NumberAns = 0
for i in range(len(nl) - 1, -1, -1):
	if nl[i] % 2 == 0:
		NumberAns = nl[i]
		break
StringAns = ''
if NumberAns == 0:
	print(n)
	print('')
	exit(0)
if NumberAns == n:
	print(0)
	print(s)
	exit(0)
else:
	g = 1
	for i in range(0, len(s)):
		if nl[i] == g:
			StringAns += s[i]
			g += 1
print(n - NumberAns)
if len(StringAns) % 2 == 1:
	StringAns = StringAns[:len(StringAns) - 1]
print(StringAns)


n = int(input())
s = input()
l = []
for i in range(n):
	if len(l) & 1 == 0:
		l.append(s[i])
	elif l[-1] != s[i]:
		l.append(s[i])
if len(l) & 1:
	l.pop()
print(n - len(l))
print(''.join(l))


x = int(input())
y = input()
t = True
s = y[0]
q = 0
for i in range(1, len(y)):
	if y[i] == y[i - 1] and t:
		q += 1
		t = not t
	else:
		s += y[i]
	t = not t
if len(s) % 2 == 0:
	print(q)
	print(s)
else:
	print(q + 1)
	print(s[:len(s) - 1])


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


import sys
input = sys.stdin.readline

def solve(n, s):
	if n == 0:
		return ''
	elif n == 1:
		return ''
	del_index = set()
	(l, r) = (0, 1)
	while r < n:
		if s[l] != s[r]:
			r += 2
			l = r - 1
		else:
			del_index.add(r)
			r += 1
	if not del_index and n % 2 == 0:
		return ''.join(s)
	elif not del_index and n % 2 == 1:
		s.pop()
		return ''.join(s)
	else:
		new_s = []
		for (i, char) in enumerate(s):
			if i in del_index:
				continue
			else:
				new_s.append(char)
		return solve(len(new_s), new_s)
n = int(input())
s = list(input().rstrip())
res = solve(n, s)
print(n - len(res))
print(res)


import os
import sys

def log(*args, **kwargs):
	if os.environ.get('CODEFR'):
		print(*args, **kwargs)
n = int(input())
s = input()
result = ''
i = 0
while i < n - 1:
	j = i + 1
	while j != n:
		if s[i] != s[j]:
			result += s[i] + s[j]
			i = j + 1
			break
		j += 1
	if j == n:
		break
print(n - len(result))
print(result)


t = int(input())
m = input()
q = list(m)
if t == 0:
	print(0)
	print('')
elif t == 1:
	print(1)
	print('')
elif t == 2:
	if q[0] == q[1]:
		print(2)
		print('')
	else:
		print(0)
		print(m)
else:
	delete = [0] * t
	p1 = 0
	p2 = 1
	count = 0
	last = 0
	for i in range(t):
		if p1 < t and p2 < t:
			if q[p1] == q[p2]:
				delete[p2] = 1
				p2 = p2 + 1
				count = count + 1
			else:
				p1 = p2 + 1
				p2 = p2 + 2
	if (t - count) % 2 != 0:
		count = count + 1
		last = last + 1
	str1 = ''
	for i in range(t):
		if delete[i] == 0:
			str1 = str1 + q[i]
	s = len(str1)
	if last > 0:
		print(count)
		print(str1[:s - 1])
	else:
		print(count)
		print(str1)


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


n = int(input())
s = input()
t = ''
lst = '1'
for x in s:
	if lst == '1':
		lst = x
	elif lst != x:
		t += lst
		t += x
		lst = '1'
print(len(s) - len(t))
print(t)


def fix_string(str, n):
	len = n
	substrings = []
	i = 0
	last_del = -1
	flip_oddity = 0
	while i < n - 1:
		if (i + flip_oddity) % 2 == 0 and str[i] == str[i + 1]:
			substrings.append(str[last_del + 1:i])
			flip_oddity ^= 1
			len -= 1
			last_del = i
		i += 1
	if len % 2 == 1:
		len -= 1
		substrings.append(str[last_del + 1:n - 1])
	else:
		substrings.append(str[last_del + 1:n])
	str = ''.join(substrings)
	return (str, n - len)

def get_input(flag=0):
	if flag:
		return input()
	return int(input())
n = get_input()
str = get_input(1)
(str, n) = fix_string(str, n)
print(n)
print(str)


(n, s) = (int(input()), input())
ans = []
for c in s:
	if len(ans) % 2 == 0 or c != ans[-1]:
		ans.append(c)
if len(ans) & 1:
	ans.pop()
print(n - len(ans))
print(*ans, sep='')


n = int(input())
s = input()
streak = 1
odp = []
for i in range(1, n):
	if s[i] != s[i - 1]:
		odp.append([s[i - 1], min(2, streak)])
		streak = 1
	else:
		streak += 1
	if i == n - 1:
		odp.append([s[i], min(2, streak)])
dl = 0
chuj = []
for i in range(len(odp)):
	if (dl + odp[i][1]) % 2 == 1:
		dl += odp[i][1]
		for j in range(odp[i][1]):
			chuj.append(odp[i][0])
	else:
		dl += 1
		chuj.append(odp[i][0])
if len(chuj) % 2 == 0:
	print(n - dl)
	for i in range(len(chuj)):
		print(chuj[i], end='')
else:
	print(n - dl + 1)
	for i in range(len(chuj) - 1):
		print(chuj[i], end='')


def is_good(s):
	if len(s) == 0:
		return True
	if len(s) % 2 != 0:
		return False
	for i in range(0, len(s), 2):
		if s[i] == s[i + 1]:
			return False
	return True
n = int(input())
s = list(input())
indices = [0] * n
if is_good(s):
	print(0)
	print(''.join(s))
else:
	k = 0
	offset = 0
	i = 0
	while i <= n - 2:
		idx = i
		if s[idx] == s[idx + 1]:
			indices[idx] = -1
			k += 1
			i -= 1
		i += 2
	if (n - k) % 2 != 0:
		indices[n - 1] = -1
		k += 1
	print(k)
	for i in range(len(indices)):
		if indices[i] != -1:
			print(s[i], end='')
	print()


n = int(input())
s = input()
r = []
last = '#'
for c in s:
	if len(r) % 2 == 0:
		r.append(c)
		last = c
	elif c != last:
		r.append(c)
		last = c
if len(r) % 2 == 1:
	r = r[:-1]
print(len(s) - len(r))
print(''.join(r))


rub = input()
line = input()
al = 0
last = ' '
gar = []
for char in line:
	if char == last and al % 2 == 1:
		continue
	else:
		al += 1
		gar.append(char)
	last = char
l = len(line)
if al % 2 == 1:
	print(l - al + 1)
	gar.pop()
else:
	print(l - al)
print(''.join(gar))


import sys, itertools, math, collections, random

def ia():
	return [int(i) for i in sys.stdin.readline().strip().split(' ')]

def ii():
	return int(sys.stdin.readline().strip())

def istr():
	return sys.stdin.readline().strip()
n = ii()
s = istr()
i = 0
gs = []
skip = 0
while i < n - 1 and i + skip < n:
	if s[i] != s[i + skip]:
		gs.append(s[i])
		gs.append(s[i + skip])
		i += skip + 1
		skip = 0
	else:
		skip += 1
print(len(s) - len(gs))
print(''.join(gs))


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import deque
n = ii()
s = si()
d = deque(s)
s1 = ''
while len(d) >= 1:
	if len(d) == 1:
		d.pop()
		break
	if d[0] == d[1]:
		d.popleft()
	else:
		s1 += d.popleft() + d.popleft()
print(n - len(s1))
print(s1)


n = int(input())
s = input()
new_s = []
le = 0
dif = False
if len(set(s)) == 1:
	print(n)
else:
	(i, j) = (0, 1)
	while j < n:
		if s[j] == s[i]:
			j += 1
		else:
			new_s.append(s[i])
			new_s.append(s[j])
			i = j + 1
			j += 2
			le += 2
	print(n - le)
	print(''.join(new_s))


n = int(input())
s = list(input())
res = []
l = 0
r = 1
while r < n:
	if s[l] != s[r]:
		res += [s[l], s[r]]
		l = r + 1
		r = l + 1
	else:
		r += 1
k = n - len(res)
print(k)
print(*res, sep='')


n = int(input())
subst = ''
cur = 0
nex = 1
arr = input()
while nex < n:
	if arr[cur] == arr[nex]:
		nex += 1
	else:
		subst += arr[cur] + arr[nex]
		cur = nex + 1
		nex += 2
print(n - len(subst))
print(subst)


n = int(input())
s = input()
i = 2
deleted = 0
a = list(s)
if len(a) > 1:
	pred_pred = a[0]
	pred = a[1]
	while i < len(a):
		if a[i] == pred and pred == pred_pred:
			a[i] = '\x00'
			deleted += 1
		else:
			pred_pred = pred
			pred = a[i]
		i += 1
	if a[0] == a[1]:
		a[1] = '\x00'
		deleted += 1
	pred = a[0]
i = 0
index = 0
while i < len(a) - 1:
	i += 1
	index += 1
	if a[i] == '\x00':
		index -= 1
		continue
	if index % 2 == 1 and a[i] == pred:
		a[i] = '\x00'
		index -= 1
		deleted += 1
	else:
		pred = a[i]
if (len(a) - deleted) % 2 == 1:
	i = len(a) - 1
	while a[i] == '\x00':
		i -= 1
	a[i] = '\x00'
	deleted += 1
print(deleted)
st = ''
for i in range(n):
	if a[i] != '\x00':
		st += a[i]
print(st)


def C():
	n = int(input())
	line = input()
	result_count = 0
	result_line = ''
	i = 0
	while True:
		if i == len(line) - 1:
			result_count += 1
			break
		if i >= len(line):
			break
		if line[i] != line[i + 1]:
			result_line += line[i] + line[i + 1]
			i += 2
		else:
			i += 1
			result_count += 1
	print(result_count)
	print(result_line)
C()


n = int(input())
s = list(input())
s = {k: v for (k, v) in enumerate(s)}
l = 0
r = 1
out = 0
while r < n:
	if s[l] == s[r]:
		del s[r]
		r += 1
		out += 1
	else:
		l = r + 1
		r = l + 1
if (n - out) % 2:
	out += 1
	if r - 1 in s:
		del s[r - 1]
	else:
		del s[l]
print(out)
print(''.join([c for (k, c) in s.items()]))


from math import gcd, sqrt

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

def li():
	return list(mi())

def ii():
	return int(input())
n = ii()
s = input()
s1 = s[0]
c = s[0]
for i in range(1, n - 1):
	if c != s[i]:
		s1 += s[i]
		s1 += s[i + 1]
		c = s[i + 1]
if c != s[n - 1]:
	s1 += s[n - 1]
	print(n - len(s1))
	print(s1)
else:
	print(n - len(s1[:-1]))
	print(s1[:-1])


n = int(input())
arr = str(input())
count1 = 0
count2 = 0
for i in range(n - 1):
	if arr[i] == arr[i + 1]:
		if i % 2 == 0:
			count1 += 1
		else:
			count2 += 1
ans = ''
i = 0
while i < n - 1:
	if arr[i] == arr[i + 1]:
		if len(ans) % 2 != 0:
			ans += arr[i]
	else:
		ans += arr[i]
	i += 1
if i < n:
	ans += arr[i]
if len(ans) % 2 != 0:
	ans = ans[:-1]
print(n - len(ans))
print(ans)


n = int(input())
s = input()
(ans, j) = ([], 0)
ans.append(s[0])
for i in range(1, n):
	if j % 2 == 0:
		if s[i] != ans[j]:
			ans.append(s[i])
			j += 1
	else:
		ans.append(s[i])
		j += 1
if len(ans) % 2 != 0:
	ans.pop()
print(len(s) - len(ans))
print(''.join(ans))


length = int(input())
word = input()
i = 0
f_string = []
while i < length - 1:
	(l_0, l_1) = (word[i], word[i + 1])
	if l_0 == l_1:
		i += 1
	else:
		f_string.append(word[i:i + 2])
		i += 2
f_string = ''.join(f_string)
if len(f_string) % 2:
	f_string.pop()
print(length - len(f_string))
print(f_string)


n = int(input())
a = input()
i = 0
b = list()
while i < len(a) // 2 * 2:
	try:
		if a[i] != a[i + 1]:
			i += 2
		else:
			b.append(i)
			i += 1
	except:
		break
if (len(a) - len(b)) % 2 != 0:
	b.append(len(a) - 1)
print(len(b))
j = 0
for i in range(len(a)):
	if j < len(b) and b[j] == i:
		j += 1
		continue
	else:
		print(a[i], end='')


n = int(input())
s = input()
if n == s.count(s[0]) or n == 1:
	print(n)
	print('')
else:
	idx = 1
	res = ''
	while idx < n:
		if s[idx] != s[idx - 1]:
			res = res + s[idx - 1] + s[idx]
			idx += 2
		else:
			idx += 1
	print(n - len(res))
	print(res)


n = int(input())
s = input()
ans = ''
for i in range(n):
	if len(ans) % 2 == 0 or ans[-1] != s[i]:
		ans += s[i]
if len(ans) % 2 == 1:
	ans = ans[:-1]
print(n - len(ans))
print(ans)


import math
for _ in range(1):
	n = int(input())
	s = input()
	ans = ''
	i = 0
	while i < n - 1:
		if s[i] != s[i + 1]:
			ans += s[i] + s[i + 1]
			i += 2
			continue
		i += 1
	print(n - len(ans))
	print(ans)


n = int(input())
s = list(input())
s.append(0)
x = s[0]
tot = ''
for i in range(n):
	if s[i] != x:
		tot += x + s[i]
		x = s[i + 1]
print(n - len(tot))
print(tot)


import math
import bisect
import heapq
from collections import defaultdict

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, x, y) = egcd(b % a, a)
		return (g, y - b // a * x, x)

def mulinv(b, n):
	(g, x, _) = egcd(b, n)
	if g == 1:
		return x % n

def isprime(n):
	for d in range(2, int(math.sqrt(n)) + 1):
		if n % d == 0:
			return False
	return True

def argsort(ls):
	return sorted(list(range(len(ls))), key=ls.__getitem__)

def f(p=0):
	if p == 1:
		return list(map(int, input().split()))
	elif p == 2:
		return list(map(int, input().split()))
	elif p == 3:
		return list(input())
	else:
		return int(input())
n = f()
s = f(3)
res = []
i = 0
while i < n - 1:
	while i < n - 1 and s[i] == s[i + 1]:
		i += 1
	if i == n - 1:
		break
	if s[i] != s[i + 1]:
		res.append(s[i])
		res.append(s[i + 1])
	else:
		res.append(s[i])
	i += 2
if len(res) % 2 == 0:
	print(n - len(res))
	print(''.join(res))
else:
	print(n - len(res) + 1)
	print(''.join(res[:-1]))


n = int(input())
s = input()
(good_s, k) = ([], 0)
good_s.append(s[0])
for i in range(1, n):
	if k % 2 == 0:
		if s[i] != good_s[k]:
			good_s.append(s[i])
			k += 1
	else:
		good_s.append(s[i])
		k += 1
if len(good_s) % 2 != 0:
	good_s.pop()
print(len(s) - len(good_s))
print(''.join(good_s))


n = int(input())
s = list(input())
ret = 0
i = 0
while i < n:
	if i - ret & 1 == 0:
		j = i + 1
		while j < n and s[i] == s[j]:
			s[j] = ''
			j += 1
			ret += 1
		i = j
	else:
		i += 1
s = ''.join(s)
if len(s) & 1 == 1:
	ret += 1
	s = s[:-1]
print(ret)
print(s)


def func(n, string):
	if n == 0:
		return (0, '')
	count = 0
	previous = string[0]
	answer = previous
	for i in range(1, n):
		if (i + count) % 2 == 0:
			answer += string[i]
			previous = string[i]
		elif string[i] != previous:
			answer += string[i]
		else:
			i += 1
			count += 1
	if len(answer) % 2 == 1:
		answer = answer[:-1]
		count += 1
	return (count, answer)
an = func(int(input()), input())
print(an[0])
print(an[1])


n = int(input())
s = input()
if s == '':
	print(0)
	print(s)
	exit()
j = 0
cnt = 0
ans = ''
i = 0
while i < len(s):
	j += 1
	if j % 2 == 0:
		ans += s[i]
		i += 1
		continue
	k = 1
	while i + k < len(s) and s[i] == s[i + k]:
		k += 1
	cnt += k - 1
	ans += s[i]
	i += k
if len(ans) % 2:
	print(cnt + 1)
	print(ans[:-1])
else:
	print(cnt)
	print(ans)


n = int(input())
s = list(input())
t = []
i = 0
while i + 1 < n:
	(a, b) = (s[i], s[i + 1])
	if a != b:
		t += [a, b]
		i += 2
	elif i + 2 < n:
		c = s[i + 2]
		if a != c:
			t += [a, c]
			i += 3
		elif b != c:
			t += [b, c]
			i += 3
		else:
			i += 2
	else:
		i += 2
print(len(s) - len(t))
print(''.join(t))


n = int(input())
s = input()
s1 = ''
s2 = ''
l = len(s)
s1 += s[0]
for i in range(1, l):
	if len(s1) % 2 != 0:
		if s[i] != s1[len(s1) - 1]:
			s1 += s[i]
	else:
		s1 += s[i]
if len(s1) % 2 == 0:
	print(len(s) - len(s1))
	print(s1)
else:
	x = len(s1) - 1
	print(len(s) - x)
	if x != 0:
		for j in range(len(s1) - 1):
			s2 += s1[j]
		print(s2)


from math import *
from collections import *
import sys
sys.setrecursionlimit(10 ** 9)
n = int(input())
a = list(input())
t = []
i = 0
while i < n - 1:
	while i < n - 1 and a[i + 1] == a[i]:
		i += 1
	if i < n - 1:
		t.append(a[i])
		t.append(a[i + 1])
	i += 2
l = len(t)
print(n - l)
print(''.join(t))


n = int(input())
a = input()
k = 0
s = 0
ans = []
for i in range(n):
	if k % 2 == 1 and a[i] != ans[-1] or k % 2 == 0:
		k += 1
		ans.append(a[i])
if k % 2 == 1:
	k -= 1
	del ans[-1]
print(n - k)
print(''.join(ans))


n = int(input())
s = input()
a = []
for x in s:
	if len(a) % 2 == 0:
		a.append(x)
	elif a[-1] != x:
		a.append(x)
if len(a) % 2 == 1:
	a.pop()
print(n - len(a))
print(''.join(a))


n = int(input())
A = list(input())
u0 = 0
u1 = 1
ans = []
while u1 < n:
	if A[u0] == A[u1]:
		u1 += 1
	else:
		u0 = u1 + 1
		ans.append(A[u1 - 1])
		ans.append(A[u1])
		u1 += 2
print(n - len(ans))
print(''.join(ans))


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


def good(s):
	result = ''
	for i in range(len(s)):
		if len(result) % 2 == 0 or result[-1] != s[i]:
			result += s[i]
	if len(result) % 2 == 1:
		result = result[:-1]
	return (len(s) - len(result), result)
n = int(input())
t = input()
print(*good(t), sep='\n')


import math
n = int(input())
a = list(input())
i = 0
j = 1
cnt = 0
b = []
while i < len(a) and j < len(a):
	if a[i] != a[j]:
		b.append(a[i])
		b.append(a[j])
		j += 2
		i = j - 1
	else:
		j += 1
		cnt += 1
if len(b) % 2 == 0:
	print(len(a) - len(b))
	print(''.join(b))
else:
	print(cnt + 1)


N = int(input())
S = input()
ans = ''
f = 0
for k in range(N - 1):
	if k % 2 == f:
		if S[k] != S[k + 1]:
			ans += S[k:k + 2]
		elif f == 0:
			f = 1
		else:
			f = 0
print(N - len(ans))
print(ans)


n = int(input())
s = input()
ans = []
i = 0
cnt = 0
while i < n:
	if i + 1 == n:
		cnt += 1
		break
	elif s[i] != s[i + 1]:
		ans.append(s[i:i + 2])
		i += 2
	else:
		j = i + 1
		while j < n and s[j] == s[i]:
			j += 1
		if j == n:
			cnt += j - i
			break
		else:
			ans.append(s[i] + s[j])
			cnt += j - i - 1
			i = j + 1
print(cnt)
print(''.join(ans))


n = int(input())
s = input()
k = 0
pre = ''
t = ''
for i in range(n):
	if k % 2 == 0:
		pre = s[i]
		k += 1
	elif pre != s[i]:
		t += pre + s[i]
		k += 1
print(n - len(t))
print(t)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
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')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

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

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(inp())
	s = list(inp())
	new = []
	j = 0
	i = 0
	if len(s) == 1:
		print(1)
		print('')
		return
	new.append(s[i])
	i += 1
	while i < n:
		f = False
		while s[i] == new[j]:
			i += 1
			if i == n:
				f = True
				break
		if f:
			new.pop(j)
			break
		new.append(s[i])
		if i + 2 < n:
			new.append(s[i + 1])
			i += 2
			j += 2
		else:
			break
	print(len(s) - len(new))
	print(''.join(new))
testcase(1)


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, OrderedDict
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
n = intIn()
s = stringIn()
ans = 0
res = []
(i, j) = (0, 1)
cnt = 0
if len(set(s)) == 1:
	print(n)
	print()
	exit(0)
while i < n and j < n:
	if s[i] != s[j]:
		res.append(s[i])
		res.append(s[j])
		i = j + 1
		j = i + 1
	else:
		cnt += 1
		j += 1
print(n - len(res))
print(''.join(res))


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

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

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_right(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		n = I()
		l = list(input())
		ans = []
		x = 0
		q = 0
		while x < n - 1:
			if l[x] != l[x + 1]:
				ans.append(l[x])
				ans.append(l[x + 1])
				x += 2
			else:
				x += 1
		if len(ans) & 1 == 1:
			l.pop(-1)
		print(n - len(ans))
		if len(ans) != 0:
			print(''.join(ans))
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


n = int(input())
s = input()
ans = 0
i = 0
lz = [0] * n
while i + 1 < n:
	if s[i] == s[i + 1]:
		lz[i] = 1
		i += 1
		ans += 1
	else:
		i += 2
ansstr = ''
for i in range(n):
	if lz[i] == 0:
		ansstr += s[i]
if len(ansstr) % 2 != 0:
	ansstr = ansstr[:-1]
	ans += 1
print(ans)
print(ansstr)


from collections import deque as de
import math
from math import sqrt as sq
from math import floor as fl
from math import ceil as ce
from sys import stdin, stdout
import re
from collections import Counter as cnt
from functools import reduce
from itertools import groupby as gb
from bisect import bisect_left as bl, bisect_right as br

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binarytodecimal(n):
	return int(n, 2)

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def getProduct(n):
	product = 1
	while n != 0:
		product = product * (n % 10)
		n = n // 10
	return product

def lcm(x, y):
	lcm = x * y // math.gcd(x, y)
	return lcm

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))

def checkisap(list):
	d = list[1] - list[0]
	for i in range(2, len(list)):
		temp = list[i] - list[i - 1]
		if temp != d:
			return False
	return True

def primes_method5(n):
	out = {}
	sieve = [True] * (n + 1)
	for p in range(2, n + 1):
		if sieve[p]:
			out[p] = 1
			for i in range(p, n + 1, p):
				sieve[i] = False
	return out

def ceildiv(x, y):
	return (x + y - 1) // y

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

def ii():
	return int(input())

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

def si():
	return list(map(str, input()))

def indict():
	dic = {}
	for (index, value) in enumerate(input().split()):
		dic[int(value)] = int(index) + 1
	return dic

def frqdict():
	dic = {}
	for (index, value) in enumerate(input()):
		if value not in dic:
			dic[value] = 1
		else:
			dic[value] += 1
	return dic
n = ii()
s = si()
ans = ''
current = None
for i in range(n):
	if current == None:
		current = s[i]
	elif s[i] != current:
		ans += current + s[i]
		current = None
if len(ans) % 2:
	print(n - len(ans) - 1)
	print(ans[:-1])
else:
	print(n - len(ans))
	print(ans)


n = int(input())
s = list(input())
i = 0
res = []
while i < n - 1:
	j = i + 1
	while j < n and s[i] == s[j]:
		j += 1
	if j < n:
		res.extend([s[i], s[j]])
	i = j + 1
print(len(s) - len(res))
print(''.join(res))


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
n = ii()
s = si()
k = ''
i = 0
while i < n - 1:
	if s[i] != s[i + 1]:
		k += s[i] + s[i + 1]
		i += 2
		continue
	i += 1
print(n - len(k))
print(k)


n = int(input())
s = str(input())
s = list(s)
s.reverse()
ans = 0
t = []
while s:
	c = s.pop()
	if len(t) % 2 == 1:
		if c == t[-1]:
			ans += 1
		else:
			t.append(c)
	else:
		t.append(c)
if len(t) % 2 == 0:
	print(ans)
	print(''.join(t))
else:
	ans += 1
	t.pop()
	print(ans)
	print(''.join(t))


import sys, os
f = lambda : list(map(int, input().split()))
if 'local' in os.environ:
	sys.stdin = open('./input.txt', 'r')

def solve():
	n = f()[0]
	s = input()
	ans = ''
	idx = 0
	for i in range(n):
		if idx == 0:
			ans += s[i]
			idx += 1
		elif idx % 2 == 1:
			if s[i] != ans[idx - 1]:
				ans += s[i]
				idx += 1
		else:
			ans += s[i]
			idx += 1
	if len(ans) % 2 == 0:
		print(n - len(ans))
		print(ans)
	else:
		print(n - len(ans) + 1)
		print(ans[:-1])
solve()


n = int(input())
a = input()
ans = 0
x = True
b = []
for i in range(n - 1):
	if x:
		if a[i] == a[i + 1]:
			b.append(i)
			ans += 1
			x = not x
	x = not x
if (n - ans) % 2:
	b.append(n - 1)
	ans += 1
print(ans)
b = set(b)
for i in range(n):
	if i not in b:
		print(a[i], end='')


import sys
from time import *
from math import *
from bisect import bisect_left as bl, bisect_right as br, bisect, insort, insort_left, insort_right
INF = float('inf')
MOD = 998244353
mod = 10 ** 9 + 7
from collections import Counter as cc, defaultdict as df, OrderedDict as od
from functools import reduce

def counter(l):
	return dict(cc(l))

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

def so(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

def rev(l):
	return list(reversed(l))

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

def i2():
	return map(int, sys.stdin.readline().strip().split())

def li():
	return list(map(int, sys.stdin.readline().strip().split()))

def i1():
	return sys.stdin.readline().strip()

def inputm(n, m):
	return [input() for i in range(n)]

def yes():
	print('YES')

def no():
	print('NO')

def p(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def main():
	n = int(input())
	s = input()
	r = []
	for i in range(n):
		if len(r) % 2 == 0 or s[i] != r[-1]:
			r.append(s[i])
	if len(r) % 2 == 1:
		r = r[:-1]
	print(n - len(r))
	print(''.join(r))
main()


def main():
	n = int(input())
	(good, string) = ('', input())
	for i in string:
		if not len(good) & 1 or good[-1] != i:
			good = good + i
	if len(good) & 1:
		good = good[:-1]
	print(n - len(good), good, sep='\n')
main()


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


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


n = int(input())
s = input()
o = 0
rem = set()
for (i, c) in enumerate(s):
	if (i ^ o) & 1:
		continue
	if i == n - 1:
		rem.add(i)
		break
	if s[i] == s[i + 1]:
		rem.add(i)
		o ^= 1
res = ''.join((s[i] for i in range(n) if i not in rem))
print(len(rem))
print(res)


n = int(input())
s = input()
d = {}
l = []
for i in range(n):
	d[i] = s[i]
count = 0
i = 0
while i < n - 1:
	if s[i] != s[i + 1]:
		i += 2
	else:
		count += 1
		l += [i]
		i += 1
for i in l:
	del d[i]
s = ''
for i in range(n):
	try:
		s += d[i]
	except:
		continue
if len(s) % 2 == 1:
	count += 1
	s = s[:-1]
print(count)
print(s)


n = int(input())
s = input()
s1 = ''
c = ''
for i in s:
	if c == '':
		c = i
		s1 += c
	elif i != c:
		c = ''
		s1 += i
if len(s1) % 2 == 1:
	s1 = s1[:-1]
print(n - len(s1))
print(s1)


n = int(input())
l = list(input())
if n == 1:
	print(1)
else:
	s = ''
	c = 0
	i = 0
	while i < n - 1:
		t = l[i]
		m = 0
		while t == l[i + 1]:
			i += 1
			if i >= n - 1:
				s += t
				m = 1
				break
		if m == 1:
			break
		s += t
		s += l[i + 1]
		i += 2
	if len(s) % 2 == 0:
		print(n - len(s))
		print(s)
	else:
		print(n - len(s) + 1)
		print(s[:-1])


n = int(input())
word = input()
i = 0
count = 0
good_idx = []
while i < len(word) - 1:
	if word[i] != word[i + 1]:
		good_idx.append(i)
		good_idx.append(i + 1)
		i += 2
	else:
		i += 1
res = ''.join(map(lambda x: word[x], good_idx))
if len(res) % 2 == 1:
	print(len(word) - len(good_idx) + 1)
	print(res[:-1])
else:
	print(len(word) - len(good_idx))
	print(res)


n = int(input())
s = input()
l = []
l.append(s[0])
for i in s:
	if len(l) % 2 == 0 or l[-1] != i:
		l.append(i)
if len(l) % 2 == 1:
	l = l[:-1]
print(n - len(l))
print(''.join(l))


import sys
chars = int(input())
string = list(input())
output = []
length = len(string)
deleted_chars = 0
deleted_char_indices = []
i = 0
while i < length:
	current_trimmed_string_length = length - deleted_chars
	if current_trimmed_string_length % 2 == 1 and current_trimmed_string_length - 1 == i - deleted_chars:
		deleted_char_indices.append(i)
		deleted_chars += 1
		break
	if string[i] == string[i + 1]:
		deleted_chars += 1
		deleted_char_indices.append(i)
		i += 1
		continue
	i += 2
print(deleted_chars)
for i in deleted_char_indices:
	string[i] = '_'
for char in string:
	if char != '_':
		print(char, end='')
print()


n = int(input())
s = input()
s = list(s)
if n == 1:
	print(1)
elif len(list(set(s))) == 1:
	print(n)
else:
	i = 0
	k = 0
	while i < n - 1:
		if s[i] == s[i + 1]:
			if i < n - 2:
				if s[i + 2] != s[i + 1]:
					s[i] = '0'
					k += 1
					i += 3
				else:
					s[i] = '0'
					s[i + 1] = '0'
					k += 2
					i += 2
			else:
				s[i] = '0'
				s[i + 1] = '0'
				i += 2
				k += 2
		else:
			i += 2
	if (n - k) % 2 != 0:
		k += 1
		del s[-1]
	print(k)
	for j in range(len(s)):
		if s[j] != '0':
			print(s[j], end='')


n = int(input())
a = input()
anss = []
ans = 0
i = 0
k = 1
while i < n:
	if i + k < n and a[i] == a[i + k]:
		if k == 1:
			anss.append(a[i])
		k += 1
	elif i + k < n and a[i] != a[i + k]:
		if k == 1:
			anss.append(a[i])
		anss.append(a[i + k])
		i += k + 1
		k = 1
	else:
		break
if len(anss) % 2 != 0:
	print(n - len(anss) + 1)
	for i in range(len(anss) - 1):
		print(anss[i], end='')
else:
	print(n - len(anss))
	for elem in anss:
		print(elem, end='')


n = int(input())
s = input()
t = list(s)
i = 0
j = 1
count = 0
while i < len(t) and j < len(t):
	if t[i] == t[j]:
		t[j] = ''
		j += 1
		count += 1
	else:
		j += 2
		i = j - 1
final = ''
for i in t:
	if i != '':
		final += i
if len(final) % 2 == 1:
	count += 1
	print(count)
	print(final[:len(final) - 1])
else:
	print(count)
	print(final)


n = int(input())
s = input()
final = ''
final += s[0]
j = 1
for i in range(1, n):
	if s[i] != final[j - 1]:
		final += s[i]
		j += 1
	elif j % 2 == 0:
		j += 1
		final += s[i]
	else:
		continue
if j % 2 == 0:
	print(n - j)
	print(final)
else:
	print(n - j + 1)
	print(final[:-1])


from collections import *
import sys

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
n = ri()
s = input()
out = []
ans = 0
letter = s[0]
i = 0
while i < n:
	letter = s[i]
	if len(out) % 2 == 0 or letter != out[-1]:
		out += [letter]
	else:
		ans += 1
	i += 1
if len(out) % 2 == 1:
	ans += 1
	out.pop()
print(ans)
print(''.join(out))


n = int(input())
s = input()
dp = []
for i in range(n):
	row = [0, []]
	dp.append(row)
dp[0][0] = 0
dp[0][1].append(s[0])
for i in range(1, n):
	prev_length = len(dp[i - 1][1])
	if prev_length % 2 == 0:
		dp[i] = dp[i - 1]
		dp[i][1].append(s[i])
	else:
		prev_value = dp[i - 1][1][-1]
		if prev_value != s[i]:
			dp[i] = dp[i - 1]
			dp[i][1].append(s[i])
		else:
			dp[i][0] = dp[i - 1][0] + 1
			dp[i][1] = dp[i - 1][1]
good_string = dp[n - 1][1]
op = dp[n - 1][0]
if len(good_string) % 2 == 1:
	op += 1
	good_string.pop()
print(op)
print(''.join(good_string))


n = int(input())
s = input()
a = []
for i in range(n):
	if len(a) == 0:
		a.append(s[i])
		continue
	elif len(a) % 2 != 0:
		if s[i] == a[-1]:
			continue
		else:
			a.append(s[i])
	else:
		a.append(s[i])
		continue
if len(a) % 2 != 0:
	a.pop(-1)
print(n - len(a))
print(''.join((str(x) for x in a)))


n = int(input())
A = input()
B = []
for i in range(len(A)):
	if len(B) % 2 == 1:
		if len(B) == 0 or B[-1] != A[i]:
			B += A[i]
	else:
		B += A[i]
if len(B) % 2 != 0:
	B.pop()
print(n - len(B))
print(''.join(B))


from sys import stdin, setrecursionlimit
from bisect import bisect_right
setrecursionlimit(15000)

def get_gdict(arr):
	gdict = dict()
	for i in range(len(arr)):
		if arr[i] in gdict:
			gdict[arr[i]] += 1
		else:
			gdict[arr[i]] = 1
	return gdict

def initial_check(barr, garr):
	for i in garr:
		if i < barr[-1]:
			return False
	return True
n = int(stdin.readline().strip())
arr = list(stdin.readline().strip())
ans = []
count = 0
i = n - 1
while i >= 0:
	if i - 1 >= 0:
		if arr[i] != arr[i - 1]:
			ans.append(arr[i])
			ans.append(arr[i - 1])
			i -= 2
			continue
		else:
			i -= 1
			count += 1
	elif len(ans) % 2 == 0:
		count += 1
		i -= 1
	elif ans[-1] != arr[i]:
		ans.append(arr[i])
print(count)
for i in range(len(ans) - 1, -1, -1):
	print(ans[i], end='')


n = int(input())
a = input()
v = ''
(i, j) = (0, 1)
while j < n:
	if a[i] == a[j]:
		j = j + 1
	else:
		v = v + a[i] + a[j]
		i = j + 1
		j = j + 2
print(n - len(v))
print(v)


n = int(input())
data = input()
p = 1
d = 0
r = []
while p < n:
	r.append(data[p - 1])
	if data[p - 1] != data[p]:
		r.append(data[p])
		p += 2
	else:
		i = p
		while i < n and data[p - 1] == data[i]:
			i += 1
			d += 1
		if i < n:
			p = i
			r.append(data[p])
			p += 2
		else:
			break
if p == n:
	r.append(data[-1])
res = ''.join(r)
if len(res) == 1:
	res = ''
	d += 1
elif len(res) > 1 and len(res) % 2 == 1:
	res = res[:-1]
	d += 1
print(d)
print(res)


n = int(input())
s = input()
if n == 0:
	print(0)
else:
	res = '' + s[0]
	c = 0
	rindex = 0
	for i in range(1, n):
		if rindex % 2 == 0:
			if s[i] != res[rindex]:
				res = res + s[i]
				rindex += 1
			else:
				c += 1
		else:
			res = res + s[i]
			rindex += 1
	if len(res) % 2 != 0:
		res = res[:-1]
		c += 1
	print(c)
	print(res)


n = int(input())
s = list(input())
i = 0
cnt = 0
ans = ''
j = 0
while i < len(s):
	if j % 2 == 0 and (i == len(s) - 1 or s[i] == s[i + 1]):
		cnt += 1
		i += 1
	else:
		i += 1
		j = 1 - j
		ans += s[i - 1]
print(cnt)
print(''.join(ans))


n = int(input())
s = input()
t = 0
result = ''
while t < len(s) - 1:
	if s[t] != s[t + 1]:
		result = result + s[t:t + 2]
		t = t + 2
	else:
		t = t + 1
if len(result) % 2 == 0:
	print(len(s) - len(result))
	print(result)
else:
	print(len(s) - len(result) + 1)
	print(result[:len(result) - 1])


input()
test_string = input()
resultstring = []
tot_del = 0
for elem in test_string:
	if len(resultstring) % 2 == 0 and resultstring != '':
		resultstring.append(elem)
	elif len(resultstring) % 2 == 1:
		if resultstring[-1] != elem:
			resultstring.append(elem)
		else:
			tot_del += 1
			pass
resultstring = ''.join(resultstring)
if len(resultstring) <= 1:
	print(tot_del + 1)
elif len(resultstring) % 2 == 0:
	print(tot_del, '\n', resultstring)
else:
	print(tot_del + 1)
	print(resultstring[:-1])


n = int(input())
a = list(input())
k = 0
na = a[0]
lsti = 0
run = True
while run:
	i = lsti + 1
	if i >= n:
		break
	while i < n and a[i] == a[lsti]:
		k += 1
		i += 1
	if i >= n:
		break
	na += a[i]
	lsti = i + 1
	if lsti >= n:
		break
	else:
		na += a[lsti]
if len(na) % 2:
	print(k + 1)
	print(na[:-1])
else:
	print(k)
	print(na)


def main():
	n = int(input())
	a = list(input())
	new = ''
	i = 0
	j = 1
	while i < n - 1 and j < n:
		while j < n and a[i] == a[j]:
			j += 1
		if j < n:
			new += a[i] + a[j]
			i = j + 1
			j = i + 1
	print(n - len(new))
	print(new)
main()


n = int(input())
s = input()
a = [s[0]]
for q in s[1:]:
	if len(a) % 2 == 0 or a[-1] != q:
		a.append(q)
if len(a) % 2 == 1:
	a.pop()
print(len(s) - len(a))
print(''.join(a))


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


n = int(input())
otv = 0
l = 0
s1 = []
s = input()
for i in range(n):
	el = s[i]
	if l % 2 == 0:
		s1.append(el)
		l += 1
	elif el != s1[l - 1]:
		s1.append(el)
		l += 1
	else:
		otv += 1
if l % 2:
	s1.pop()
	otv += 1
print(otv)
print(''.join(s1))


n = int(input())
s = input()
ans = []
last = ''
j = 0
for i in range(len(s)):
	if j % 2 == 0:
		j += 1
		ans.append(s[i])
		last = s[i]
	elif last != s[i]:
		j += 1
		ans.append(s[i])
		last = s[i]
m = len(ans)
if m % 2 != 0:
	m -= 1
	ans = ans[:m]
print(n - m)
print(''.join(ans))


n = int(input())
s = input()
i = 0
j = 1
ans = s[0]
while j < n:
	if ans[i] != s[j]:
		ans += s[j]
		try:
			ans += s[j + 1]
		except:
			pass
		i += 2
		j += 2
	elif ans[i] == s[j]:
		j += 1
if len(ans) % 2:
	print(len(s) - len(ans) + 1)
	print(ans[0:len(ans) - 1])
else:
	print(len(s) - len(ans))
	print(ans)


def fun(n, string):
	isFirst = True
	ans = []
	for i in range(n):
		if isFirst:
			ans += string[i]
			isFirst = False
		elif string[i] != ans[-1]:
			ans += string[i]
			isFirst = True
	if len(ans) % 2:
		ans = ans[:-1]
	print(n - len(ans))
	print(''.join(ans))
n = int(input())
string = input()
fun(n, string)


n = int(input())
a = input()
(odd, even) = (0, 0)
ps = '1'
chett = []
i = 0
ans = 0
new_s = []
pk = 'c'
for l in a:
	i += 1
	if l == ps:
		if i % 2 == 0:
			k = 'n'
		else:
			k = 'c'
		if k == pk:
			new_s.append(l)
		else:
			ans += 1
		pk = k
	else:
		new_s.append(l)
	ps = l
if len(new_s) % 2 == 1:
	new_s = new_s[:-1]
	ans += 1
print(ans)
print(''.join(new_s))


n = int(input())
string = input()
res = ''
finalresult = ''
for i in range(0, len(string)):
	if len(res) % 2 == 0 or res[-1] != string[i]:
		res += string[i]
if len(res) % 2 == 1:
	finalresult = res[0:len(res) - 1]
else:
	finalresult = res
print(n - len(finalresult))
print(finalresult)


n = int(input())
s = input()
cp = []
i = 0
j = 1
while j < n:
	if s[i] == s[j]:
		j += 1
	else:
		cp += s[i] + s[j]
		i = j + 1
		j += 2
print(n - len(cp))
print(*cp, sep='')


n = int(input())
a = input()
ct = 0
i = 1
x = []
while i < n:
	if a[i] != a[ct]:
		x.append(a[ct])
		x.append(a[i])
		ct = i + 1
		i += 2
	else:
		i += 1
print(n - len(x))
print(''.join(x))


from sys import stdin
from math import gcd, sqrt
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
hg = lambda x, y: (y + x - 1) // x * x
n = I()
s = list(S())
dlt = 0
for i in range(n - 1):
	if (i + 1 + dlt) % 2 and s[i] == s[i + 1]:
		s[i] = '*'
		dlt += 1
print(dlt + (n - dlt) % 2)
print(''.join(s).replace('*', '')[:n - dlt - (n - dlt) % 2])


n = int(input())
line = input()
d = 0
i = 0
k = n - 1
new = ''
while i < k:
	if line[i] == line[i + 1]:
		pass
	else:
		new += line[i] + line[i + 1]
		i += 1
	i += 1
print(len(line) - len(new))
print(new)


n = int(input())
s = list(input())
new_s = []
ans = 0
for i in range(n):
	if len(new_s) % 2 == 0:
		new_s.append(s[i])
	elif s[i] != new_s[len(new_s) - 1]:
		new_s.append(s[i])
	else:
		ans += 1
if len(new_s) % 2 != 0:
	new_s.pop(len(new_s) - 1)
	ans += 1
print(ans)
for i in new_s:
	print(i, end='')


a = int(input())
b = input()
k = []
t = 1
for i in b:
	if t % 2 == 0:
		if k[-1] == i:
			continue
		else:
			k.append(i)
			t += 1
	else:
		k.append(i)
		t += 1
if len(k) % 2 == 1:
	k = k[:-1]
c = a - len(k)
print(c)
if c == 0:
	print('good')
else:
	print(''.join(k))


n = int(input())
st = input()
ind = 0
kol = 0
new = ''
i = 0
while i < n:
	new += st[i]
	j = i + 1
	while j < n and st[j] == st[i] and (ind % 2 == 0):
		j += 1
		kol += 1
	i = j
	ind += 1
if len(new) % 2 == 1:
	new = new[:-1]
	kol += 1
print(kol)
print(new)


n = int(input())
a = input()
c = 0
s = 0
ans = ''
for i in range(n):
	if s == 0:
		s = 1
		p = a[i]
		ans = ans + p
	elif s == 1:
		if a[i] != p:
			s = 0
			ans = ans + a[i]
		else:
			c = c + 1
if (n - c) % 2 != 0:
	c = c + 1
	ans = ans[:-1]
print(c)
print(ans)


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


import sys
n = int(sys.stdin.readline())
arr = list(sys.stdin.readline().rstrip())
i = 0
check = [True] * n
st = 0
while i < n:
	if st % 2 == 0:
		j = i + 1
		while j < n:
			if arr[j] != arr[i]:
				break
			check[j] = False
			j += 1
		i = j
	else:
		i += 1
	st += 1
cnt = 0
for i in range(n):
	if check[i]:
		cnt += 1
if cnt % 2 == 0:
	temp = 0
	for i in range(n):
		if not check[i]:
			temp += 1
	ans = []
	for i in range(n):
		if check[i]:
			ans.append(arr[i])
	print(temp)
	print(''.join(ans))
else:
	for i in range(n - 1, -1, -1):
		if check[i]:
			check[i] = False
			break
	temp = 0
	for i in range(n):
		if not check[i]:
			temp += 1
	ans = []
	for i in range(n):
		if check[i]:
			ans.append(arr[i])
	print(temp)
	print(''.join(ans))


import math
from decimal import Decimal

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)
n = int(input())
a = input()
new = ''
for i in a:
	if len(new) % 2 == 0:
		new += i
	elif new[-1] != i:
		new += i
if len(new) % 2 == 1:
	new = new[:len(new) - 1]
print(n - len(new))
print(new)


num = int(input())
s = input()
(i, l) = (0, num)
while i + 1 < l:
	if s[i] != s[i + 1]:
		i += 2
		continue
	j = i + 2
	while j < l and s[i] == s[j]:
		j += 1
	if j < l:
		s = s[:i + 1] + s[j:]
		l -= j - i - 1
	else:
		s = s[:i + 1]
		l = i + 1
	i += 2
if len(s) % 2:
	s = s[:-1]
print(num - len(s))
print(s)


def f(s, n):
	i = 0
	j = 1
	while i < len(s) - 1:
		if s[i] == s[j]:
			while j < len(s):
				if s[i] == s[j]:
					j += 1
				else:
					break
			s = s[:i + 1] + s[j:]
		i += 2
		j = i + 1
	if len(s) % 2 == 0:
		if s[0] == s[1]:
			print(n)
			print('')
			return
		print(n - len(s))
		print(s)
		return
	s = s[:-1]
	print(n - len(s))
	print(s)
	return
a = int(input())
b = input()
f(b, a)


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
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')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 10 ** 9 + 7
EPS = 1e-06

def value():
	return tuple(map(int, input().split()))

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

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
s = input()
ans = []
i = 0
while i < n:
	t = s[i]
	i += 1
	while i < n and s[i] == t:
		i += 1
	if i < n:
		ans.append(t)
		ans.append(s[i])
	i += 1
print(n - len(ans))
print(*ans, sep='')


def fastio():
	import sys
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n,) = I()
s = input()
l = []
l.append(s[0])
f = 0
m = [s[-1]]
for i in s[1:]:
	if f:
		f = 0
		l.append(i)
	elif l[-1] != i:
		l.append(i)
		f = 1
f = 0
for i in s[::-1][1:]:
	if f:
		f = 0
		m.append(i)
	elif m[-1] != i:
		m.append(i)
		f = 1
a = len(l)
b = len(m)
m = list(reversed(m))
if a & 1:
	a -= 1
	l = l[:-1]
if b & 1:
	b -= 1
	m = m[:-1]
a = len(l)
b = len(m)
if a >= b:
	print(n - a)
	print(''.join(l))
else:
	print(n - b)
	print(''.join(m))


n = int(input())
s = input()
t = ''
lst = '1'
for i in s:
	if lst == '1':
		lst = i
		nw = ''
	elif lst != i:
		t += lst
		t += i
		lst = '1'
print(len(s) - len(t))
print(t)


N = int(input())
S = input()
prev = ''
ans = 0
deleted = set()
flg = True
i = 0
while i <= N - 1:
	if flg and (i - ans) % 2 == 0:
		prev = S[i]
		i += 1
	elif prev == S[i]:
		flg = False
		ans += 1
		deleted.add(i)
		i += 1
		continue
	else:
		i += 1
		flg = True
T = ''
for i in range(N):
	if i in deleted:
		continue
	else:
		T += S[i]
if len(T) % 2 == 1:
	print(ans + 1)
	print(T[:-1])
else:
	print(ans)
	print(T)


n = int(input())
s = 0
z = []
for i in input():
	if len(z) % 2 == 0:
		z += [i]
	elif i != z[-1]:
		z += [i]
	else:
		s += 1
if len(z) % 2 != 0:
	s += 1
	z = z[:-1]
print(s)
print(*z, sep='')


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


n = int(input())
st = input()
s = []
i = 0
j = 1
while j < n:
	if st[i] == st[j]:
		j = j + 1
	else:
		s += st[i] + st[j]
		i = j + 1
		j = i + 1
print(n - len(s))
print(*s, sep='')


n = int(input())
s = input()
q = ''
i = 0
while i < n - 1:
	if s[i] == s[i + 1]:
		i += 1
	else:
		q += s[i] + s[i + 1]
		i += 2
print(abs(n - len(q)))
print(q)


def go():
	n = int(input())
	a = [i for i in input()]
	if n == 1:
		return '1\n'
	i = 1
	while i < n:
		if a[i] == a[i - 1]:
			a[i - 1] = None
			i += 1
		else:
			i += 2
	a = ''.join((i for i in a if i is not None))
	if len(a) % 2 == 1:
		a = a[:-1]
	return '{}\n{}'.format(n - len(a), a)
print(go())


n = int(input())
l = list(input())
c = 0
i = 0
l2 = []
while i < n:
	if i == n - 1:
		c += 1
		i += 1
	elif l[i] == l[i + 1]:
		c += 1
		i += 1
	else:
		l2 += [l[i]]
		l2 += [l[i + 1]]
		i += 2
if len(l2) % 2 == 0:
	print(c)
	print(''.join((x for x in l2)))
else:
	print(c)
	print(''.join((x for x in l[:len(l2)])))


import sys

def main():
	n = int(sys.stdin.readline())
	a = input()
	out = []
	index = None
	f = 0
	number = 1
	if n % 2 == 1:
		for i in range(n - 1):
			if (i + 1) % 2 == 1 and a[i] == a[i + 1]:
				index = i
				break
		else:
			index = n - 1
	for i in range(n):
		if i < f or i == index:
			continue
		if number % 2 == 0 or (number % 2 == 1 and i < n - 1 and (a[i] != a[i + 1])):
			out += a[i]
			number += 1
	sys.stdout.write(str(n - len(out)) + '\n')
	for i in out:
		sys.stdout.write(str(i))
main()


n = int(input())
s = input()
count = 0
ptr = 0
str_len = n
result = ''
even = False
while ptr < n:
	if not even:
		result += s[ptr]
		even = True
	elif not result[-1:] is s[ptr]:
		result += s[ptr]
		even = False
	else:
		count += 1
	ptr += 1
if len(result) % 2 != 0:
	result = result[:len(result) - 1]
	str_len = len(result)
	count += 1
print('{}'.format(count))
print('{}'.format(result))


n = int(input())
s1 = input()
s = []
res = 0
change = 0
for i in range(n):
	s.append(s1[i])
for i in range(1, n):
	if i % 2 and (not change):
		if s[i - 1] == s[i]:
			s[i - 1] = ''
			change = 1
			res += 1
	elif not i % 2 and change:
		if s[i - 1] == s[i]:
			s[i - 1] = ''
			change = 0
			res += 1
if (n - res) % 2:
	s.pop()
	res += 1
	n -= 1
print(res)
for i in range(n):
	if s[i] == '':
		pass
	else:
		print(s[i], end='')


n = int(input())
a = input()
i = 0
count = 2 - n % 2
out = ''
while i < n - 1:
	if a[i] == a[i + 1]:
		i += 1
		continue
	out += a[i:i + 2]
	i += 2
out = out[:len(out) - len(out) % 2]
print(len(a) - len(out))
print(out)


sz = int(input())
v = list(input())
PAR = 0
IMPAR = 1
good = []
c = 0
NEXT = IMPAR
for i in range(sz - 1):
	if v[i] == '*':
		continue
	if (i + 1) % 2 == NEXT:
		p = v[i]
		j = 0
		try:
			while v[i + j] == v[i + 1 + j]:
				v[i + j] = '*'
				j += 1
				c += 1
		except:
			pass
		if NEXT == IMPAR:
			if j % 2:
				NEXT = PAR
		elif j % 2:
			NEXT = IMPAR
v = ''.join(v)
v = v.replace('*', '')
if len(v) % 2 == 1:
	print(c + 1)
	print(v[:-1])
else:
	print(c)
	print(v)


n = int(input())
myStr = list(input())
l = len(myStr)
i = 0
anslist = list()
while i < l:
	if len(anslist) % 2 == 0 or anslist[-1] != myStr[i]:
		anslist.append(myStr[i])
	i += 1
if len(anslist) % 2 != 0:
	anslist.pop()
print(l - len(anslist))
print(''.join(anslist))


def get_num():
	return int(input())

def print_arr(arr: list):
	for val in arr:
		print(val)
n = get_num()
s = input()
if not s:
	print_arr([0, ''])
new_str = ''
i = 0
j = 1
while j < len(s):
	if s[i] == s[j]:
		j += 1
	else:
		new_str = new_str + s[i] + s[j]
		i = j + 1
		j = i + 1
print_arr([len(s) - len(new_str), new_str])


import io
import os
from collections import defaultdict
from sys import stdin, stdout

def main():
	n = int(input())
	s = input()
	res = []
	pos = 0
	while pos + 1 < n:
		if s[pos] != s[pos + 1]:
			res.append(s[pos])
			res.append(s[pos + 1])
			pos += 2
		else:
			res.append(s[pos])
			while pos < n and s[pos] == res[-1]:
				pos += 1
			if pos < n:
				res.append(s[pos])
				pos += 1
	if len(res) % 2 == 1:
		res.pop()
	print(n - len(res))
	print(''.join(map(str, res)))
main()


import sys
input = sys.stdin.readline().strip()
input1 = sys.stdin.readline().strip()
new_st = ''
for x in range(0, len(input1)):
	if len(new_st) == 0:
		new_st += input1[x]
		continue
	if len(new_st) % 2 == 1 and new_st[-1] == input1[x]:
		continue
	else:
		new_st = new_st + input1[x]
if len(new_st) % 2 == 1:
	print(len(input1) - (len(new_st) - 1))
	print(new_st[0:-1])
else:
	print(len(input1) - len(new_st))
	print(new_st)


while True:
	try:
		n = int(input())
		s = input()
		a = []
		if s == '':
			print(0)
		i = 0
		while True:
			if i >= n or i + 1 >= n:
				break
			if s[i] != s[i + 1]:
				a.append(s[i:i + 2])
				i += 2
			else:
				i += 1
		r = ''.join(a)
		print(len(s) - len(r))
		print(r)
	except:
		break


n = int(input())
st = list(input())
answer = 0
i = 0
while i < len(st) - 1:
	if st[i] == st[i + 1]:
		answer += 1
		st[i] = -1
		i += 1
	else:
		i += 2
st = ''.join((i for i in st if i != -1))
if len(st) % 2 != 0:
	st = st[:-1]
	answer += 1
print(answer)
print(st)


import sys
from itertools import accumulate

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
N = INT()
S = input()
stack = []
cnt = 0
for (i, s) in enumerate(S):
	stack.append(s)
	if len(stack) % 2 == 0:
		if stack[-2] == stack[-1]:
			stack.pop()
			cnt += 1
if len(stack) % 2 == 1:
	stack.pop()
	cnt += 1
print(cnt)
print(''.join(stack))


n = int(input())
s = input()
cnt = 0
res = s[0]
l = 0
r = 1
while r < len(s):
	while r < len(s) and s[l] == s[r]:
		r += 1
	if r < n:
		res += s[r]
	l = r + 1
	if l < n:
		res += s[l]
	r = l + 1
res = res if len(res) % 2 == 0 else res[:len(res) - 1]
print(n - len(res))
print(res if len(res) % 2 == 0 else res[:len(res) - 1])


n = int(input())
s = input().strip()
arr = []
for i in range(n):
	if len(arr) % 2 == 0 or (len(arr) > 0 and arr[-1] != s[i]):
		arr.append(s[i])
if len(arr) % 2 != 0:
	arr.pop()
print(n - len(arr))
print(''.join(arr))


n = int(input())
s = input()
removals = []
i = 0
while i < n:
	if i < n - 1 and s[i] == s[i + 1]:
		while i < n - 1 and s[i] == s[i + 1]:
			removals.append(i + 1)
			i += 1
	i += 2
removals_len = len(removals)
ans = []
j = 0
for i in range(n):
	if j < removals_len and i == removals[j]:
		j += 1
	else:
		ans.append(s[i])
if len(ans) & 1 == 1:
	print(removals_len + 1)
	print(''.join(ans[0:-1]))
else:
	print(removals_len)
	print(''.join(ans))


import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
decimal.getcontext().prec = 46

def primeFactors(n):
	prime = set()
	while n % 2 == 0:
		prime.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			prime.add(i)
			n = n // i
	if n > 2:
		prime.add(n)
	return list(prime)

def getFactors(n):
	factors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				factors.append(i)
			else:
				factors.append(i)
				factors.append(n // i)
		i = i + 1
	return factors

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	num = []
	for p in range(2, n + 1):
		if prime[p]:
			num.append(p)
	return num

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

def sort_dict(key_value):
	return sorted(key_value.items(), key=lambda kv: (kv[1], kv[0]))

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

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

def string_list():
	return list(input())

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def binaryToDecimal(n):
	return int(n, 2)

def DFS(n, s, adj):
	visited = [False for i in range(n)]
	stack = []
	stack.append(s)
	while len(stack):
		s = stack[-1]
		stack.pop()
		if not visited[s]:
			visited[s] = True
		for node in adj[s]:
			if not visited[node]:
				stack.append(node)

def solve():
	n = int(input())
	s = list(input())
	op = 0
	ans = ''
	i = 0
	while i < n:
		if len(ans) % 2 != 0:
			if ans[-1] == s[i]:
				while i < n and ans[-1] == s[i]:
					i += 1
					op += 1
				if i < n:
					ans += s[i]
					i += 1
			else:
				ans += s[i]
				i += 1
		else:
			ans += s[i]
			i += 1
	if len(ans) % 2 == 0:
		print(op)
		print(ans)
	else:
		print(op + 1)
		print(ans[:len(ans) - 1])
t = 1
for _ in range(t):
	solve()


n = int(input())
s = list(input())
i = 0
t = 0
dels = 0
ans = []
s.append('\\')
while i < n:
	ans.append(s[i])
	if i % 2 == t:
		while s[i] == s[i + 1]:
			i += 1
			t = 1 - t
			dels += 1
	i += 1
if (n - dels) % 2 == 0:
	print(dels)
	print(''.join(ans))
else:
	dels += 1
	print(dels)
	print(''.join(ans[:-1]))


n = int(input())
s = input()
ss = ''
si = 0
while si < n - 1:
	if s[si] == s[si + 1]:
		si += 1
		continue
	ss += s[si] + s[si + 1]
	si += 2
print(n - len(ss))
print(ss)


import sys
input = sys.stdin.readline
n = int(input())
s = input()[:-1]
ans = ''
se = set()
for i in range(n):
	if s[i] not in se:
		ans += s[i]
		se.add(s[i])
	if len(se) == 2:
		se = set()
if len(ans) % 2 == 1:
	ans = ans[:-1]
print(len(s) - len(ans))
print(ans)


import sys

def inpu():
	return sys.stdin.readline().strip()
n = int(inpu())
s = list(inpu())
k = 0
i = 0
ans = []
s += '-'
while i <= n - 1:
	if s[i] == s[i + 1]:
		i += 1
		k += 1
	else:
		ans.append(s[i])
		ans.append(s[i + 1])
		i += 2
try:
	ans.remove('-')
except ValueError:
	a = 2
if len(ans) % 2 == 0:
	print(k)
	print(''.join(ans))
else:
	print(k + 1)
	print(''.join(ans[:len(ans) - 1]))


n = int(input())
a = list(input())
i = 0
k = 0
b = []
while 2 * i + k < n - 1:
	if a[2 * i + k] == a[2 * i + k + 1]:
		k += 1
	else:
		b.append(a[2 * i + k])
		b.append(a[2 * i + k + 1])
		i += 1
print(k + (n - k) % 2)
print(*b, sep='')


n = int(input())
a = list(input())
nt = 0
count = 0
pt = 1
if n == 1:
	count = 0
while 1:
	if pt <= n - 1 and nt <= n - 1:
		if a[nt] == a[pt]:
			a[pt] = '0'
			count += 1
			pt += 1
		else:
			nt = pt + 1
			pt += 2
	else:
		break
ans = []
for i in range(n):
	if a[i] != '0':
		ans.append(a[i])
if len(ans) % 2 == 0:
	print(count)
	print(''.join(ans))
else:
	count += 1
	print(count)
	print(''.join(ans[:len(ans) - 1]))


n = int(input())
s = input()
res = []
i = 0
while i + 1 < n:
	if s[i] == s[i + 1]:
		i += 1
	else:
		res.append(s[i:i + 2])
		i += 2
print(n - 2 * len(res))
print(''.join(res))


def main():
	from sys import stdin, stdout

	def read():
		return stdin.readline().rstrip('\n')

	def read_array(sep=None, maxsplit=-1):
		return read().split(sep, maxsplit)

	def read_int():
		return int(read())

	def read_int_array(sep=None, maxsplit=-1):
		return [int(a) for a in read_array(sep, maxsplit)]

	def write(*args, **kwargs):
		sep = kwargs.get('sep', ' ')
		end = kwargs.get('end', '\n')
		stdout.write(sep.join((str(a) for a in args)) + end)

	def write_array(array, **kwargs):
		sep = kwargs.get('sep', ' ')
		end = kwargs.get('end', '\n')
		stdout.write(sep.join((str(a) for a in array)) + end)
	n = read_int()
	s = read()
	out = []
	for ch in s:
		if not out or out[-1] != ch or len(out) % 2 == 0:
			out.append(ch)
	if len(out) % 2:
		out.pop()
	write(n - len(out))
	write(''.join(out))
main()


N = int(input())
s = input()
res = ''
i = -1
try:
	while True:
		i += 1
		find = s[i]
		i += 1
		while s[i] == find:
			i += 1
		res += find + s[i]
except:
	pass
print(len(s) - len(res))
print(res)


n = int(input())
s = input()
st = []
st.append(s[0])
for i in range(1, n):
	if st[-1] == s[i] and len(st) & 1:
		pass
	else:
		st.append(s[i])
if len(st) & 1:
	st.pop()
print(n - len(st))
print(*st, sep='')


n = int(input())
s = input()
count = 0
prev = s[0]
ba = [prev]
ans = 0
for i in range(1, n):
	if s[i] == prev and (i + 1 - ans) % 2 == 0:
		ans += 1
	else:
		prev = s[i]
		ba.append(prev)
if len(ba) % 2 == 0:
	print(ans)
	print(''.join(ba))
else:
	print(ans + 1)
	s = []
	for i in range(len(ba) - 1):
		s.append(ba[i])
	print(''.join(s))


from sys import stdin, stdout

def INI():
	return int(stdin.readline())

def INL():
	return [int(_) for _ in stdin.readline().split()]

def INS():
	return stdin.readline()

def OPS(ans):
	stdout.write(str(ans) + '\n')

def OPL(ans):
	[stdout.write(str(_) + ' ') for _ in ans]
	stdout.write('\n')
n = INI()
S = INS()
t = n
ans = ''
_ = 0
while _ < n - 1:
	if S[_] == S[_ + 1]:
		x = S[_]
		while _ < n:
			if x != S[_]:
				break
			_ += 1
		else:
			break
		ans += x + S[_]
		_ += 1
	else:
		ans += S[_] + S[_ + 1]
		_ += 2
OPS(n - len(ans))
OPS(ans)


n = int(input())
s = [x for x in input()]
srev = list(reversed(s))
ans = []
while len(srev) > 1:
	di = []
	di.append(srev.pop())
	di.append(srev.pop())
	while di[0] == di[1]:
		di.pop()
		if len(srev) == 0:
			break
		di.append(srev.pop())
	if len(di) == 2:
		ans.append(di)
print(n - len(ans) * 2)
for i in ans:
	print(i[0], i[1], sep='', end='')


n = int(input())
s = input()
ans = ''
i = 0
j = 1
de = 0
while j < n and i < n:
	while j < n and s[i] == s[j]:
		j += 1
		de += 1
	if j < n:
		ans += s[i] + s[j]
		i = j + 1
		j = i + 1
if i < n:
	print(de + 1)
else:
	print(de)
print(ans)


n = int(input())
s = input()
l = list(s)
a = list()
count = 0
a.append(s[0])
for i in range(1, n):
	if len(a) % 2 == 0:
		a.append(s[i])
	elif a[-1] != s[i]:
		a.append(s[i])
	else:
		count += 1
if (n - count) % 2 == 1:
	count += 1
	del a[-1]
print(count)
print(''.join(a))


def main():
	n = int(input())
	s = input()
	stack = []
	ans = 0
	for i in range(n):
		stack.append((s[i], len(stack)))
		if len(stack) > 1:
			if stack[-2][0] == stack[-1][0] and stack[-2][1] % 2 == 0:
				ans += 1
				stack.pop()
	if len(stack) % 2 == 0:
		print(ans)
		for i in range(len(stack)):
			print(stack[i][0], end='')
	else:
		print(ans + 1)
		for i in range(len(stack) - 1):
			print(stack[i][0], end='')
main()


def good_string(n, s):
	a = []
	res = 0
	for i in s:
		if len(a) % 2 == 0:
			a.append(i)
		elif a[-1] != i:
			a.append(i)
	if len(a) % 2 != 0:
		a.pop()
	res = len(s) - len(a)
	print(res)
	print(''.join(a))
n = int(input())
s = input()
good_string(n, s)


from operator import itemgetter
from collections import Counter
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
n = ii()
s = si()
k = ''
i = 0
while i < n:
	if i != n - 1:
		if s[i] != s[i + 1]:
			k += s[i] + s[i + 1]
			i += 2
			continue
	i += 1
print(n - len(k))
print(k)


n = int(input())
use = [True for i in range(n)]
s = input()
now = 0
flag = 0
for i in range(1, n):
	if flag == 1:
		flag = 0
		continue
	if s[now] == s[i]:
		use[i] = False
	else:
		flag = 1
		now = i + 1
ans = ''
for i in range(n):
	if use[i]:
		ans += s[i]
if len(ans) % 2 == 1:
	ans = ans[:-1]
print(n - len(ans))
print(ans)


n = int(input())
s = input() + '!!!!!'
i = 0
ans = 0
ss = ''
while s[i] != '!':
	j = i + 1
	if s[j] == '!':
		ans += 1
		i += 1
	elif s[i] != s[j]:
		ss = ss + s[i] + s[j]
		i += 2
	else:
		while s[j] == s[i]:
			j += 1
			ans += 1
		if s[j] != '!':
			ss = ss + s[i] + s[j]
		else:
			ans = ans + 1
		i = j + 1
print(ans)
print(ss)


gi = lambda : list(map(int, input().strip().split()))
(n,) = gi()
s = list(input())
st = []
for e in s:
	if st and st[-1] == e and len(st) % 2:
		st.pop()
		st.append(e)
	else:
		st.append(e)
if len(st) % 2:
	st.pop()
print(n - len(st))
print(''.join(st))


n = int(input())
s = str(input())
l = [s[0]]
lchar = s[0]
nchar = 1
for i in range(1, n):
	if s[i] == lchar and nchar % 2 == 1:
		pass
	else:
		l.append(s[i])
		lchar = s[i]
		nchar += 1
if nchar % 2 == 1:
	nchar -= 1
l = l[:nchar]
print(n - nchar)
print(''.join(l))


n = int(input())
s = list(input())
a = s.copy()
cnt = 0
for i in range(n - 1):
	if s[i] == s[i + 1] and (i - cnt) % 2 == 0 or s[i - 1] == s[i] == s[i + 1]:
		a[i + 1] = ''
		cnt += 1
a = ''.join(a).split()
if len(a[0]) % 2 != 0:
	a[0] = a[0][:-1]
if len(a[0]) != 0:
	print(n - len(a[0]))
else:
	print(n)
print(*a, sep='')


n = int(input())
s = input()
ans = []
i = 0
while i < len(s) - 1:
	if s[i] != s[i + 1]:
		ans.extend((s[i], s[i + 1]))
		i += 2
	else:
		i += 1
if len(ans) % 2 == 1:
	ans = ans[:-1]
print(n - len(ans))
print(''.join(ans))


a = int(input())
b = list(input())
p = 0
d = 0
while p < a - 1:
	if b[p] == b[p + 1]:
		b[p] = ''
		p += 1
		d += 1
	else:
		p += 2
b = ''.join(b)
if len(b) % 2 == 1:
	d += 1
	b = b[0:len(b) - 1]
print(d)
print(b)


n = int(input())
s = input()
t = []
first = 0
second = first + 1
if n == 1:
	print(1)
else:
	while (first and second) <= len(s) - 1:
		if s[first] == s[second]:
			first = second
			second = first + 1
		else:
			t.append(s[first])
			t.append(s[second])
			first = second + 1
			second = first + 1
	if first == len(s) - 1:
		t.append(s[first])
	if len(t) % 2 != 0:
		t.pop()
	print(len(s) - len(t))
	for i in t:
		print(i, end='')