You are given the string s of length n and the numbers p, q. Split the string s to pieces of length p and q.

For example, the string "Hello" for p = 2, q = 3 can be split to the two strings "Hel" and "lo" or to the two strings "He" and "llo".

Note it is allowed to split the string s to the strings only of length p or to the strings only of length q (see the second sample test).


-----Input-----

The first line contains three positive integers n, p, q (1 ≤ p, q ≤ n ≤ 100).

The second line contains the string s consists of lowercase and uppercase latin letters and digits.


-----Output-----

If it's impossible to split the string s to the strings of length p and q print the only number "-1".

Otherwise in the first line print integer k — the number of strings in partition of s.

Each of the next k lines should contain the strings in partition. Each string should be of the length p or q. The string should be in order of their appearing in string s — from left to right.

If there are several solutions print any of them.


-----Examples-----
Input
5 2 3
Hello

Output
2
He
llo

Input
10 9 5
Codeforces

Output
2
Codef
orces

Input
6 4 5
Privet

Output
-1

Input
8 1 1
abacabac

Output
8
a
b
a
c
a
b
a
c

Source: codeforces | Difficulty: EASY
Tags: String algorithms

Implementation

Complete search


Solutions:
(n, a, b) = list(map(int, input().split(' ')))
s = input()
c = 0
while c * a <= n and (n - c * a) % b != 0:
	c += 1
if c * a > n:
	print(-1)
else:
	cb = (n - a * c) // b
	print(c + cb)
	for i in range(c):
		print(s[a * i:a * (i + 1)])
	for i in range(cb):
		print(s[c * a + b * i:c * a + b * (i + 1)])


(n, p, q) = [int(j) for j in input().split()]
s = str(input())
(x, y) = (-1, -1)
found = False
for j in range(101):
	for k in range(101):
		res = j * p + k * q
		if res == n:
			(x, y) = (j, k)
			found = True
			break
		elif res > n:
			break
	if found == True or j * p > n:
		break
if found == False:
	print(-1)
else:
	(p1, p2) = (0, p)
	List = []
	for j in range(x):
		List.append(s[p1:p2])
		p1 += p
		p2 += p
	p2 = p1 + q
	for j in range(y):
		List.append(s[p1:p2])
		p1 += q
		p2 += q
	print(len(List))
	for j in range(len(List)):
		print(List[j])


(n, p, q) = map(int, input().split())
s = input()
for i in range(n + 1):
	for j in range(n + 1):
		if i * p + j * q == n:
			print(i + j)
			for ii in range(i):
				print(s[ii * p:(ii + 1) * p])
			for jj in range(j):
				print(s[i * p + jj * q:i * p + (jj + 1) * q])
			exit()
print('-1')


(n, p, q) = map(int, input().split())
(a, b, f) = (0, 0, 0)
st = input()
for v in range(0, n + 1):
	for u in range(0, n + 1):
		if v * p + u * q == n:
			a = v
			b = u
			f = 1
			break
if f == 0:
	print('-1')
	quit()
print(a + b)
x = 0
while x < n:
	if a > 0:
		print(st[x:x + p])
		x = x + p
		a = a - 1
	else:
		print(st[x:x + q])
		x = x + q


(n, p, q) = map(int, input().split())
s = input()
subs = []
temp = s
while n > 0 and p <= n:
	if n % q == 0:
		break
	subs.append(s[:p])
	s = s[p:]
	n = len(s)
while n > 0 and q <= n:
	subs.append(s[:q])
	s = s[q:]
	n = len(s)
if n == 0:
	print(len(subs))
	for i in range(len(subs)):
		print(subs[i])
else:
	print('-1')


(n, p, q) = map(int, input().split())
s = input()
f = 0
for i in range(0, 101):
	for j in range(0, 101):
		if p * i + q * j == n:
			f = 1
			print(i + j)
			P = 0
			for x in range(p, p * i + 1, p):
				print(s[P:x])
				P = x
			for x in range(q + P, n + 1, q):
				print(s[P:x])
				P = x
			break
	if f:
		break
if f ^ 1:
	print(-1)


from functools import cmp_to_key
from collections import deque, Counter
from heapq import heappush, heappop
from math import log, ceil
import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
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))

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()

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

def ii():
	return int(inp())

def si():
	return str(inp())

def li(lag=0):
	l = list(map(int, inp().split()))
	if lag != 0:
		for i in range(len(l)):
			l[i] += lag
	return l

def mi(lag=0):
	matrix = list()
	for i in range(n):
		matrix.append(li(lag))
	return matrix

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

def print_list(lista, space=' '):
	print(space.join(map(str, lista)))

def bisect_left(a, x):
	left = 0
	right = len(a)
	while left < right:
		mid = (left + right) // 2
		if a[mid] < x:
			left = mid + 1
		else:
			right = mid
	return left

def bisect_right(a, x):
	left = 0
	right = len(a)
	while left < right:
		mid = (left + right) // 2
		if a[mid] > x:
			right = mid
		else:
			left = mid + 1
	return left

def bisect_elements(a, x):
	return bisect_right(a, x) - bisect_left(a, x)
MOD = 10 ** 9 + 7
maxN = 5
FACT = [0] * maxN
INV_FACT = [0] * maxN

def add(x, y):
	return (x + y) % MOD

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

def power(x, y):
	if y == 0:
		return 1
	elif y % 2:
		return multiply(x, power(x, y - 1))
	else:
		a = power(x, y // 2)
		return multiply(a, a)

def inverse(x):
	return power(x, MOD - 2)

def divide(x, y):
	return multiply(x, inverse(y))

def allFactorials():
	FACT[0] = 1
	for i in range(1, maxN):
		FACT[i] = multiply(i, FACT[i - 1])

def inverseFactorials():
	n = len(INV_FACT)
	INV_FACT[n - 1] = inverse(FACT[n - 1])
	for i in range(n - 2, -1, -1):
		INV_FACT[i] = multiply(INV_FACT[i + 1], i + 1)

def coeffBinom(n, k):
	if n < k:
		return 0
	return multiply(FACT[n], multiply(INV_FACT[k], INV_FACT[n - k]))

def create_graph(n, m, undirected=1, unweighted=1):
	graph = [[] for i in range(n)]
	if unweighted:
		for i in range(m):
			[x, y] = li(lag=-1)
			graph[x].append(y)
			if undirected:
				graph[y].append(x)
	else:
		for i in range(m):
			[x, y, w] = li(lag=-1)
			w += 1
			graph[x].append([y, w])
			if undirected:
				graph[y].append([x, w])
	return graph

def create_tree(n, unweighted=1):
	children = [[] for i in range(n)]
	if unweighted:
		for i in range(n - 1):
			[x, y] = li(lag=-1)
			children[x].append(y)
			children[y].append(x)
	else:
		for i in range(n - 1):
			[x, y, w] = li(lag=-1)
			w += 1
			children[x].append([y, w])
			children[y].append([x, w])
	return children

def dist(tree, n, A, B=-1):
	s = [[A, 0]]
	(massimo, massimo_nodo) = (0, 0)
	distanza = -1
	v = [-1] * n
	while s:
		(el, dis) = s.pop()
		if dis > massimo:
			massimo = dis
			massimo_nodo = el
		if el == B:
			distanza = dis
		for child in tree[el]:
			if v[child] == -1:
				v[child] = 1
				s.append([child, dis + 1])
	return (massimo, massimo_nodo, distanza)

def diameter(tree):
	(_, foglia, _) = dist(tree, n, 0)
	(diam, _, _) = dist(tree, n, foglia)
	return diam

def dfs(graph, n, A):
	v = [-1] * n
	s = [[A, 0]]
	v[A] = 0
	while s:
		(el, dis) = s.pop()
		for child in graph[el]:
			if v[child] == -1:
				v[child] = dis + 1
				s.append([child, dis + 1])
	return v

def bfs(graph, n, A):
	v = [-1] * n
	s = deque()
	s.append([A, 0])
	v[A] = 0
	while s:
		(el, dis) = s.popleft()
		for child in graph[el]:
			if v[child] == -1:
				v[child] = dis + 1
				s.append([child, dis + 1])
	return v

def parents_children_root_unrooted_tree(tree, n, root=0):
	q = deque()
	visited = [0] * n
	parent = [-1] * n
	children = [[] for i in range(n)]
	q.append(root)
	while q:
		all_done = 1
		visited[q[0]] = 1
		for child in tree[q[0]]:
			if not visited[child]:
				all_done = 0
				q.appendleft(child)
		if all_done:
			for child in tree[q[0]]:
				if parent[child] == -1:
					parent[q[0]] = child
					children[child].append(q[0])
			q.popleft()
	return (parent, children)

def all_longest_path_passing_from_node(parent, children, n):
	q = deque()
	visited = [len(children[i]) for i in range(n)]
	downwards = [[0, 0] for i in range(n)]
	upward = [1] * n
	longest_path = [1] * n
	for i in range(n):
		if not visited[i]:
			q.append(i)
			downwards[i] = [1, 0]
	while q:
		node = q.popleft()
		if parent[node] != -1:
			visited[parent[node]] -= 1
			if not visited[parent[node]]:
				q.append(parent[node])
		else:
			root = node
		for child in children[node]:
			downwards[node] = sorted([downwards[node][0], downwards[node][1], downwards[child][0] + 1], reverse=True)[0:2]
	s = [node]
	while s:
		node = s.pop()
		if parent[node] != -1:
			if downwards[parent[node]][0] == downwards[node][0] + 1:
				upward[node] = 1 + max(upward[parent[node]], downwards[parent[node]][1])
			else:
				upward[node] = 1 + max(upward[parent[node]], downwards[parent[node]][0])
		longest_path[node] = downwards[node][0] + downwards[node][1] + upward[node] - min([downwards[node][0], downwards[node][1], upward[node]]) - 1
		for child in children[node]:
			s.append(child)
	return longest_path
(n, p, q) = li()
s = str(inp())
found = [-1, -1]
for i in range(0, 102 * p, p):
	r = n - i
	if r >= 0 and r % q == 0:
		found = [i // p, r // q]
if found[0] == -1:
	print('-1')
else:
	print(found[0] + found[1])
	s1 = s[:found[0] * p]
	s2 = s[found[0] * p:]
	for i in range(found[0]):
		print(s1[i * p:(i + 1) * p])
	for i in range(found[1]):
		print(s2[i * q:(i + 1) * q])


(n, p, q) = list(map(int, input().split()))
s = input()
m = 0
while m * p <= n:
	if (n - m * p) % q == 0:
		k = m + (n - m * p) // q
		print(k)
		for i in range(m):
			print(s[p * i:p * (i + 1)])
		for i in range(k - m):
			print(s[p * m + q * i:p * m + q * (i + 1)])
		break
	m += 1
else:
	print(-1)


from bisect import bisect
from itertools import permutations, combinations
res = []
(n, p, q) = map(int, input().split())
s = input()
for i in range(n):
	for j in range(n):
		if n == p * i + q * j:
			print(i + j)
			for z in range(i):
				print(s[p * z:p * (z + 1)])
			for v in range(j):
				print(s[i * p + q * v:i * p + q * (v + 1)])
			quit()
if n == p == q:
	print(n)
	print(s)
	quit()
print(-1)


R = lambda : map(int, input().split())
(n, p, q) = R()
s = input()
for a in range(n // p + 1):
	r = n - p * a
	if r % q == 0:
		b = r // q
		print(a + b)
		for i in range(a):
			print(s[p * i:p * i + p])
		for i in range(b):
			print(s[p * a + q * i:p * a + q * i + q])
		exit()
print(-1)


(n, p, q) = map(int, input().split())
s = input()
verbose = False
dp = 0
dq = 0
for i in range(n // p + 1):
	if (n - p * i) % q == 0:
		dp = i
		dq = round((n - p * i) / q)
		verbose = True
		break
if verbose == False:
	print(-1)
else:
	print(dp + dq)
	for i in range(0, dp * p, p):
		print(s[i:i + p])
	for i in range(p * dp, len(s), q):
		print(s[i:i + q])


def splitt():
	(n, p, q) = map(int, input().split())
	ch = input()
	test = False
	for i in range(0, n + 1):
		for j in range(0, n + 1):
			if i * p + j * q == n:
				test = True
				break
	if test == False:
		print(-1)
	if test == True:
		for k in range(n):
			if n - k * p < 0:
				break
			if (n - k * p) % q == 0:
				z = (n - k * p) // q
				ind = 0
				T = []
				for i in range(k):
					T.append(ch[ind:ind + p])
					ind += p
				for i in range(z):
					T.append(ch[ind:ind + q])
					ind += q
				print(len(T))
				for j in T:
					print(j)
				return
splitt()


(n, p, q) = map(int, input().split())
s = input()
k1 = 0
k = 0
r = n // p
for i in range(r, -1, -1):
	if (n - p * i) % q == 0:
		k1 = i
		k = k1 + (n - p * i) // q
if k == 0:
	print(-1)
else:
	print(k)
	for i in range(k1):
		print(s[i * p:(i + 1) * p])
	for i in range(k - k1):
		print(s[p * k1 + i * q:p * k1 + (i + 1) * q])


def STR():
	return list(input())

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

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

def MAP2():
	return map(float, input().split())

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

def STRING():
	return input()
import string
import sys
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter, defaultdict
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
(n, p, q) = MAP()
s = STR()
ans = []
(r1, r2) = (0, 0)
for i in range(n + 1):
	x1 = i * p
	x2 = n - x1
	x3 = x2 % q
	if x3 == 0:
		r1 = i
		r2 = x2 // q
		break
if r1 == r2 == 0 or r1 < 0 or r2 < 0:
	print('-1')
	exit(0)
(x, y) = (r1, r2)
v1 = ''
for i in range(0, r1 * p):
	v1 += s[i]
	if len(v1) == p:
		ans.append(v1)
		v1 = ''
v2 = ''
for i in range(r1 * p, n):
	v2 += s[i]
	if len(v2) == q:
		ans.append(v2)
		v2 = ''
if len(ans) == r1 + r2:
	print(len(ans))
	for i in ans:
		print(i)
else:
	print('-1')


def subset_sum(numbers, target, string, partial=[]):
	s = sum(partial)
	if s == target:
		index = 0
		print(len(partial))
		for x in partial:
			print(string[index:index + x])
			index = index + x
		exit(0)
	if s >= target:
		return
	for i in range(len(numbers)):
		n = numbers[i]
		remaining = numbers[i:]
		subset_sum(remaining, target, string, partial + [n])
(n, p, q) = map(int, input().split())
string = input()
subset_sum([p, q], n, string)
print('-1')


(n, p, q) = map(int, input().split())
s = input()
flag = False
for i in range(100):
	for j in range(100):
		if i * p + j * q == n:
			store = (i, j)
			flag = True
			break
	if flag:
		break
if not flag:
	print(-1)
else:
	print(i + j)
	x = 0
	for k in range(i):
		print(s[x:x + p])
		x += p
	for k in range(j):
		print(s[x:x + q])
		x += q


(n, p, q) = map(int, input().split())
s = input()
b = 1
for x in range(0, int(n / p) + 1):
	for y in range(0, int(n / q) + 1):
		u = x * p + y * q
		if u != 0 and n % u == 0:
			b = 0
			print(int(x + y) * int(n / u))
			for j in range(x * int(n / u)):
				print(s[j * p:(j + 1) * p])
			for j in range(y * int(n / u)):
				print(s[x * int(n / u) * p + j * q:x * int(n / u) * p + (j + 1) * q])
			break
	if b == 0:
		break
if b == 1:
	print(-1)


import math

def splitText(n, p, q, string):
	a = max(p, q)
	b = min(p, q)
	repsA = math.floor(n / a)
	splitsA = n - repsA * a
	stop = 0
	while splitsA % b != 0 and stop < 1000:
		repsA -= 1
		splitsA = n - repsA * a
		stop += 1
	if stop >= 1000:
		print('-1')
		return
	repsB = math.floor(splitsA / b)
	subPalabras = []
	indexInicial = 0
	indexFinal = a
	for i in range(0, repsA):
		subPalabras.append(string[indexInicial:indexFinal])
		indexInicial = indexFinal
		indexFinal += a
	indexInicial = indexFinal - a
	indexFinal += b - a
	for i in range(0, repsB):
		subPalabras.append(string[indexInicial:indexFinal])
		indexInicial = indexFinal
		indexFinal += b
	lenSP = len(subPalabras)
	for i in range(0, lenSP):
		if len(subPalabras[i]) != p and len(subPalabras[i]) != q:
			print('-1')
			return
	print(lenSP)
	for i in range(0, lenSP):
		print(subPalabras[i])
(n, p, q) = map(int, str(input()).split(' '))
s = str(input())
splitText(n, p, q, s)


def f(n, p, q):
	mp = n // p
	mq = n // q
	for i in range(mp + 1):
		for j in range(mq + 1):
			if i * p + j * q == n:
				return (i, j)
	return (-1, -1)
(n, p, q) = list(map(int, input().strip().split()))
s = str(input())
(i, j) = f(n, p, q)
if i == -1 and j == -1:
	print(-1)
else:
	print(i + j)
	for a in range(i):
		print(s[a * p:(a + 1) * p])
	for b in range(j):
		print(s[b * q + i * p:(b + 1) * q + i * p])


(n, p, q) = input().split()
n = int(n)
p = int(p)
q = int(q)
s = input()
for i in range(101):
	for j in range(101):
		if i * p + j * q == n:
			print(i + j)
			for a in range(i):
				print(s[a * p:(a + 1) * p])
			for b in range(j):
				print(s[i * p + b * q:i * p + (b + 1) * q])
			exit()
print('-1')


import bisect
from itertools import accumulate
import os
import sys
import math
from decimal import *
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

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

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
(n, p, q) = map(int, input().split())
s = input()
for i in range(111):
	for j in range(111):
		if p * i + q * j == n:
			n = -1
			print(i + j)
			for l in range(i):
				print(s[:p])
				s = s[p:]
			for l in range(j):
				print(s[:q])
				s = s[q:]
if n != -1:
	print(-1)


(n, p, q) = map(int, input().split())
word = input()

def estcomb(n, p, q):
	l = n // p
	for i in range(0, l + 1):
		k = i * p
		a = i
		j = 0
		while k < n:
			k += q
			j += 1
		if k == n:
			return (1, a, j)
	return (0, a, j)
(c, i, j) = estcomb(n, p, q)
d = 0
e = 0
f = 0
if c == 0:
	print(-1)
else:
	print(i + j, '\n')
	for a in range(0, i):
		print(word[a + f:a + p + f], '\n')
		f += p - 1
		d += p
	for b in range(d, d + j):
		print(word[b + e:b + q + e], '\n')
		e += q - 1


(n, p, q) = list(map(int, input().split()))
w = input()
if q > p:
	(p, q) = (q, p)
results = []
st = 0
while len(w) - st > 0:
	if len(w) - st < q:
		results = None
		break
	if (len(w) - st) % q == 0:
		for i in range(0, len(w) - st, q):
			results.append(w[st + i:st + i + q])
		break
	elif len(w) - st >= p:
		results.append(w[st:st + p])
		st += p
	else:
		results = None
		break
if results:
	print(len(results))
	for l in results:
		print(l)
else:
	print(-1)


import sys
import string
import math

def find_mcd(n, p, q):
	if n < p and n < q:
		return (-1, -1)
	if n % p == 0:
		return (n / p, 0)
	if n % q == 0:
		return (0, n / q)
	i = n // p + 1
	j = 0
	while j < n // q + 1:
		x = p * i + j * q
		if x == n:
			return (i, j)
		elif x > n:
			i -= 1
		else:
			j += 1
	return (-1, -1)

def text_split(text, p, q):
	(ip, jq) = find_mcd(len(text), p, q)
	if ip < 0 and jq < 0:
		return False
	res = []
	i = 0
	while ip > 0:
		ip -= 1
		res.append(text[i:i + p])
		i += p
	while jq > 0:
		jq -= 1
		res.append(text[i:i + q])
		i += q
	return res
assert text_split('hello', 2, 3) == ['he', 'llo']
assert text_split('hello', 3, 2) == ['hel', 'lo']
assert text_split('Codeforces', 9, 5) == ['Codef', 'orces']
assert text_split('Privet', 4, 5) == False
assert text_split('abacabac', 1, 1) == ['a', 'b', 'a', 'c', 'a', 'b', 'a', 'c']
(n, p, q) = [int(d) for d in sys.stdin.readline().rstrip('\n').split(' ')]
s = sys.stdin.readline().rstrip('\n')
res = text_split(s, p, q)
if res == False:
	print('-1')
else:
	print(len(res))
	print('\n'.join(res))


(n, p, q) = map(int, input().split())
s = input()
x = 0
while p * x <= n:
	if (n - p * x) % q == 0:
		y = (n - p * x) // q
		print(x + y)
		l = 0
		while x > 0:
			x -= 1
			for i in range(p):
				print(s[l], end='')
				l += 1
			print()
		while y > 0:
			y -= 1
			for i in range(q):
				print(s[l], end='')
				l += 1
			print()
		exit(0)
	x += 1
print(-1)


(n, p, q) = map(int, input().split())
l = list(input())
for i in range(n // p + 1):
	co = 1
	for j in range(n // q + 1):
		if i * p + j * q == n:
			co = 0
			break
	if co == 0:
		break
else:
	print(-1)
	exit()
print(i + j)
for k in range(i):
	li = l[k * p:(k + 1) * p]
	print(*li, sep='')
	co = (k + 1) * p
for k in range(j):
	li = l[co + k * q:co + (k + 1) * q]
	print(*li, sep='')


numbers = list(map(int, input().split()))
string = input()
length = numbers[0]
l1 = numbers[1]
l2 = numbers[2]
counter = 0
max = max(l1, l2)
min = min(l1, l2)

def combinations():
	temp = max
	while temp < length:
		if (length - temp) % min == 0:
			s_de_max = int(temp / max)
			s_de_min = int((length - temp) / min)
			return True
		else:
			temp += max
	return False
if l1 + l2 == length:
	print(2)
	print(string[0:l1] + '\n' + string[l1:length])
elif length % l1 == 0:
	i = 0
	print(int(length / l1))
	while i < length:
		print(string[i:i + l1])
		i += l1
elif length % l2 == 0:
	i = 0
	print(int(length / l2))
	while i < length:
		print(string[i:i + l2])
		i += l2
elif combinations():
	counter = 0
	strings = []
	i = 0
	while (length - i) % l2 != 0:
		counter += 1
		strings.append(string[i:i + l1])
		i += l1
	while i < length:
		counter += 1
		strings.append(string[i:i + l2])
		i += l2
	print(counter)
	for s in strings:
		print(s)
else:
	print(-1)


(n, p, q) = list(map(int, input().split()))
s = input()
dp = [0] * (n + max(p, q) + 1)
dp[0] = 1
for i in range(n + 1):
	if dp[i] == 0:
		continue
	dp[i + p] = 1
	dp[i + q] = 1
if not dp[n]:
	print('-1')
	exit()
ans = []
while n:
	if n >= p and dp[n - p] == 1:
		ans.append(p)
		n -= p
	if n >= q and dp[n - q] == 1:
		ans.append(q)
		n -= q
print(len(ans))
ind = 0
for size in ans:
	print(s[ind:ind + size])
	ind += size


S = input().split()
n = int(S[0])
p = int(S[1])
q = int(S[2])
s = input()
i = 0
t = 0
c = 0
b = 0
if n % q == 0 and n % p != 0:
	print(int(n / q))
	for k in range(0, n, q):
		print(s[k:k + q])
elif n % p == 0 and n % q != 0:
	print(int(n / p))
	for k in range(0, n, p):
		print(s[k:k + p])
elif n % q == 0 and n % p == 0:
	print(int(n / p))
	for k in range(0, n, p):
		print(s[k:k + p])
else:
	while n > 0 and i == 0:
		n -= p
		if n % q == 0 and n > 0:
			i = 1
		t += 1
	if i == 1:
		print(int(t + n / q))
		for k in range(0, t):
			print(s[c:c + p])
			c += p
			b += p
		for k in range(0, int(n / q)):
			print(s[b:b + q])
			b += q
	else:
		print(-1)


input1 = input()
input1 = input1.split()
n = int(input1[0])
p = int(input1[1])
q = int(input1[2])
if p > q:
	(p, q) = (q, p)
string = input()
prev = [-1] * (n + 1)
nr_splits = [0] * (n + 1)
prev[0] = 0
for i in range(p, q):
	if prev[i - p] != -1:
		prev[i] = p
		nr_splits[i] = nr_splits[i - p] + 1
for i in range(q, n + 1):
	if prev[i - p] != -1:
		prev[i] = p
		nr_splits[i] = nr_splits[i - p] + 1
	elif prev[i - q] != -1:
		prev[i] = q
		nr_splits[i] = nr_splits[i - q] + 1
if prev[n] == -1:
	print(-1)
else:
	print(nr_splits[n])
	i = 0
	while n > 0:
		print(string[i:i + prev[n]])
		i = i + prev[n]
		n = n - prev[n]


def printLetters(word):
	for l in word:
		print(l)

def printSegments(word, size):
	print(int(len(word) / size))
	for i in range(0, int(len(word) / size)):
		print(word[i * size:i * size + size])

def split(word, a, b):
	index = 0
	size = len(word[index:])
	words = []
	while size % b != 0:
		words.append(word[index:index + a])
		index += a
		size = len(word[index:])
	if size < b:
		print(-1)
		return
	if size == 0:
		print(len(words))
		for w in words:
			print(w)
		return
	while index < len(word):
		words.append(word[index:index + b])
		index += b
	print(len(words))
	for w in words:
		print(w)

def divide(word, n, p, q):
	if p > n and q > n:
		print(-1)
		return
	if p == 1 or q == 1:
		print(n)
		printLetters(word)
		return
	if n % p == 0:
		printSegments(word, p)
		return
	if n % q == 0:
		printSegments(word, q)
		return
	if p < q:
		split(word, p, q)
	else:
		split(word, q, p)
l = input().split()
n = int(l[0])
p = int(l[1])
q = int(l[2])
word = input()
divide(word, n, p, q)


(n, p, q) = map(int, input().split())
ch = input()
l = len(ch)
idx1 = 0
idx2 = 0
if n % p == 0:
	print(n // p)
	idx1 = 0
	for i in range(n // p):
		print(ch[idx1:idx1 + p])
		idx1 += p
elif n % q == 0:
	print(n // q)
	for i in range(n // q):
		print(ch[idx2:idx2 + q])
		idx2 += q
elif n % p % q == 0:
	print(n // p + n % p // q)
	for i in range(n // p):
		print(ch[idx1:idx1 + p])
		idx1 += p
	idx2 = idx1
	for i in range(n % p // q):
		print(ch[idx2:idx2 + q])
		idx2 += q
elif n % q % p == 0:
	print(n // q + n % q // p)
	for i in range(n // q):
		print(ch[idx2:idx2 + q])
		idx2 += q
	idx1 = idx2
	for i in range(n % q // p):
		print(ch[idx1:idx1 + p])
		idx1 += p
else:
	nb1 = n
	nb2 = 0
	while nb1 % q != 0 and nb1 - p >= 0:
		nb1 -= p
		nb2 += 1
	if nb1 % q == 0:
		print(nb2 + nb1 // q)
		for i in range(nb2):
			print(ch[idx1:idx1 + p])
			idx1 += p
		idx2 = idx1
		for i in range(nb1 // q):
			print(ch[idx2:idx2 + q])
			idx2 += q
	elif nb1 % q != n:
		nb1 = n
		nb2 = 0
		while nb1 % p != 0 and nb1 - q >= 0:
			nb1 -= q
			nb2 += 1
		if nb1 % p == 0:
			print(nb2 + nb1 // p)
			for i in range(nb2):
				print(ch[idx1:idx1 + q])
				idx1 += q
			idx2 = idx1
			for i in range(nb1 // p):
				print(ch[idx2:idx2 + p])
				idx2 += p
		else:
			print(-1)


import math
import sys, string
input = sys.stdin.readline
import random
from collections import deque, defaultdict
import bisect
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
(n, p, q) = M()
s = input()
if n % p == 0:
	print(n // p)
	for i in range(0, n, p):
		print(s[i:i + p])
elif n % q == 0:
	print(n // q)
	for i in range(0, n, q):
		print(s[i:i + q])
else:
	w = min(p, q)
	c = 0
	y = max(q, p)
	while n % y != 0 and n >= 0:
		n -= w
		c += 1
	if n % y == 0:
		print(c + n // y)
		i = 0
		while c != 0:
			print(s[i:i + w])
			i += w
			c -= 1
		c = n // y
		while c != 0:
			print(s[i:i + y])
			i += y
			c -= 1
	else:
		print(-1)


l = input().split(' ')
s = input()
n = int(l[0])
f1 = int(l[1])
f2 = int(l[2])
if n % f1 == 0:
	i = 1
	x = n // f1
	d = 0
	print(x)
	while i <= x:
		print(s[d:d + f1])
		i += 1
		d += f1
elif n % f2 == 0:
	d = 0
	i = 1
	x = n // f2
	print(x)
	while i <= x:
		print(s[d:d + f2])
		i += 1
		d += f2
else:
	(n1, n2) = (0, 0)
	f = True
	while f == True and n > 0:
		n -= f1
		n1 += 1
		if n % f2 == 0 and n > 0:
			n2 += n // f2
			f = False
			n = 0
	n = int(l[0])
	if n1 * f1 + n2 * f2 == n:
		i = 1
		print(n1 + n2)
		d = 0
		while i <= n1:
			print(s[d:d + f1])
			d += f1
			i += 1
		i = 1
		while i <= n2:
			print(s[d:d + f2])
			d += f2
			i += 1
	else:
		print(-1)


(n, p, q) = map(int, input().split())

def main():
	s = input()
	f = 0
	for i in range(n // p + 1):
		if (n - p * i) % q == 0:
			f = 1
			break
	if n % p == 0:
		i = n // p
		f = 1
	if not f:
		print(-1)
	else:
		print(i + (n - i * p) // q)
		for j in range(i):
			print(s[j * p:j * p + p])
		for j in range((n - i * p) // q):
			print(s[i * p + q * j:i * p + q * j + q])
main()


(n, p, q) = map(int, input().split())
word = input()
p_factor = -1
q_factor = -1
for i in range(n // p + 1):
	if (n - i * p) % q == 0:
		p_factor = i
		q_factor = (n - i * p) // q
if p_factor != -1 and q_factor != -1:
	print(p_factor + q_factor)
	idx = 0
	for i in range(p_factor):
		print(word[idx:idx + p])
		idx += p
	for i in range(q_factor):
		print(word[idx:idx + q])
		idx += q
else:
	print(-1)


def solve(n: int, p: int, q: int, s: str):
	for a in range(n // p + 1):
		if (n - a * p) % q == 0:
			b = (n - a * p) // q
			print(a + b)
			for pos in range(0, a * p, p):
				print(s[pos:pos + p])
			for pos in range(a * p, n, q):
				print(s[pos:pos + q])
			return
	print(-1)
(n, p, q) = map(int, input().split())
s = input()
solve(n, p, q, s)


def calc(n, p, q, s):
	for totalPCharacters in range(0, n + 1, p):
		if (n - totalPCharacters) % q == 0:
			pWords = int(totalPCharacters / p)
			qWords = int((n - p * pWords) / q)
			totalQCharacters = q * qWords
			print(pWords + qWords)
			for i in range(0, totalPCharacters, p):
				print(s[i:i + p])
			for i in range(totalPCharacters, n, q):
				print(s[i:i + q])
			return
	print(-1)
npq = [int(x) for x in input().split()]
s = input()
n = npq[0]
p = npq[1]
q = npq[2]
calc(n, p, q, s)


sn = list(map(int, input().split()))
n = sn[0]
p = sn[1]
q = sn[2]
s = input()
lim = 0
flag = False
flag2 = False
strings = []
while lim <= n:
	if (n - lim) % p == 0:
		flag = True
		break
	elif (n - lim) % q == 0:
		flag = True
		break
	lim += p
lim = 0
if flag:
	while (n - lim) % q != 0 and n - lim >= 0:
		strings.append(s[lim:lim + p])
		lim += p
	while n - lim >= 0:
		strings.append(s[lim:lim + q])
		lim += q
		flag2 = True
	if flag2:
		lim -= q
	else:
		lim -= p
	if n - lim != 0:
		print(-1)
	else:
		print(len(strings) - 1)
		for i in strings:
			print(i)
else:
	print(-1)


(n, p, q) = map(int, input().split())
s = input()
(a, b) = (0, 0)
while n >= b * q:
	if (n - b * q) % p == 0:
		a = (n - b * q) / p
		break
	b += 1
if n < b * q:
	print('-1')
else:
	print(int(a + b))
	i = 0
	while a > 0:
		print(s[i:p + i])
		a -= 1
		i += p
	while b > 0:
		print(s[i:q + i])
		b -= 1
		i += q


(n, p, q) = map(int, input().split())
s = input()
a = 0
b = 0
is_ok = False
while a * p <= n:
	if (n - a * p) % q == 0:
		b = (n - a * p) // q
		is_ok = True
		break
	a += 1
if is_ok:
	print(a + b)
	for i in range(a):
		print(s[i * p:i * p + p])
	p = p * a
	s = s[p:]
	for i in range(b):
		print(s[q * i:q * i + q])
else:
	print(-1)


import sys
fin = sys.stdin
(n, p, q) = map(int, fin.readline().split())
s = fin.readline().rstrip()
(kp, kq) = (None, None)
for i in range(0, n // p + 1):
	if not (n - i * p) % q:
		(kp, kq) = (i, (n - i * p) // q)
		break
else:
	print(-1)
	return
print(kp + kq)
(cpos, m) = (0, p * kp)
while cpos < m:
	print(s[cpos:cpos + p])
	cpos += p
while cpos < n:
	print(s[cpos:cpos + q])
	cpos += q


(n, p, q) = map(int, input().split())
s = input()
if n % p == 0:
	print(n // p)
	for i in range(n // p):
		print(s[p * i:p * (i + 1)])
elif n % q == 0:
	print(n // q)
	for i in range(n // q):
		print(s[q * i:q * (i + 1)])
else:
	ans = -1
	for i in range(1, n // p + 1):
		if (n - p * i) % q == 0:
			ans = i
	if ans == -1:
		print(-1)
		exit()
	print(ans + (n - p * ans) // q)
	for i in range(ans):
		print(s[p * i:p * (i + 1)])
	for i in range(ans * p, n, q):
		print(s[i:i + q])


(n, p, q) = map(int, input().split())
text = input()
tab = []
while len(text) >= p and len(text) % q != 0:
	tab += [text[-p:]]
	text = text[:-p]
if len(text) % q == 0:
	while len(text) > 0:
		tab += [text[-q:]]
		text = text[:-q]
	print(len(tab))
	print('\n'.join(reversed(tab)))
else:
	print(-1)


[n, a, b] = [int(n) for n in input().split(' ')]
w = input()
found = False
for i in range(0, int(n / a) + 1):
	if (n - a * i) % b == 0:
		found = True
		p = i
		q = int((n - a * i) / b)
		print(p + q)
		for j in range(0, p):
			print(w[a * j:a * (j + 1)])
		for k in range(0, q):
			print(w[a * p + b * k:a * p + b * (k + 1)])
		break
if not found:
	print(-1)


(n, p, q) = map(int, input().split())
tmp = 0
fl = 0
m = 0
if p > q:
	tmp = p
	p = q
	q = tmp
s = input()
tk = 0
tb = 0
if p > n and q > n:
	print(-1)
elif n % q == 0:
	print(n // q)
	for i in range(n // q):
		print(s[i * q:i * q + q])
elif n % p == 0:
	print(n // p)
	for i in range(n // p):
		print(s[i * p:i * p + p])
else:
	while n % q != 0 and n > 0:
		tk += 1
		n -= p
	if n < 0:
		print(-1)
	else:
		tb = n // q
		print(tk + tb)
		for i in range(tk):
			print(s[m:m + p])
			m += p
		for i in range(tb):
			print(s[m:m + q])
			m += q


data = input().split()
(n, k, l) = [int(item) for item in data]
s = input()
j = -1
i = 0
while i * k <= n:
	if (n - k * i) % l == 0:
		j = (n - k * i) // l
		break
	i += 1
if j == -1:
	print(-1)
else:
	print(i + j)
	for idx in range(i):
		print(s[idx * k:(1 + idx) * k])
	for idx in range(j):
		print(s[k * i + idx * l:k * i + (1 + idx) * l])


(len_string, p, q) = [int(x) for x in input().split()]
string = input()
substrings = []
big = max([p, q])
small = min([p, q])
force1 = True
force2 = True

def group(size, n=False):
	global len_string, string, substring
	while len_string >= size:
		substrings.append(string[0:size])
		string = string[size:]
		len_string -= size
		if n:
			break

def force_group(p, q):
	global len_string
	groups = []
	local = len_string
	for x in range(p, len_string, p):
		local -= p
		groups.append(p)
		if (len_string - x) % q != 0:
			continue
		for y in range(0, len_string - x, q):
			local -= q
			groups.append(q)
		break
	if local == 0:
		for x in groups:
			group(x, True)
		return True
	return False
while len_string > 0:
	if len_string % p == 0:
		group(p)
	elif len_string % q == 0:
		group(q)
	elif len_string % p % q == 0:
		group(p)
		group(q)
	elif len_string % q % p == 0:
		group(q)
		group(p)
	elif force1:
		if force_group(p, q):
			break
		force1 = False
	elif force2:
		if force_group(q, p):
			break
		force2 = False
	else:
		print(-1)
		exit()
print(len(substrings))
for w in substrings:
	print(w)


def f(n, p, q, s):
	for i in range(n // p + 1):
		for j in range(n // q + 1):
			if i * p + j * q == n:
				print(i + j)
				for k in range(i):
					print(s[k * p:(k + 1) * p])
				for k in range(j):
					print(s[i * p + k * q:i * p + (k + 1) * q])
				return 1
	return -1
((n, p, q), s) = (map(int, input().strip().split()), input())
if -1 == f(n, p, q, s):
	print(-1)


import sys
(n, p, q) = [int(x) for x in input().split()]
(possible, possible2, possiblePQ) = (True, True, True)
subs = list()
s = input()
sArr = list(s)
if n % p == 0:
	possible = False
	possible2 = False
	pCount = 0
	aux = ''
	for s1 in sArr:
		aux += s1
		pCount += 1
		if pCount == p:
			subs.append(aux)
			pCount = 0
			aux = ''
if n % q == 0 and possible:
	possiblePQ = False
	qCount = 0
	aux = ''
	for s1 in sArr:
		aux += s1
		qCount += 1
		if qCount == q:
			subs.append(aux)
			qCount = 0
			aux = ''
if possible2 and possiblePQ:
	letter = p
	sliced = False
	while s != '':
		if sliced is False:
			if len(s) >= letter:
				y = s[0:letter]
				subs.append(y)
				s = s[letter:]
			else:
				letter = q
				sliced = True
		elif len(subs) != 0:
			if len(s) % q == 0:
				y = s[0:letter]
				subs.append(y)
				s = s[letter:]
			else:
				s = subs.pop(len(subs) - 1) + s
		else:
			print(-1)
			sys.exit(0)
	if len(subs) != 0:
		print(len(subs))
		for i in range(0, len(subs), 1):
			print(subs[i])
		sys.exit(0)
print(len(subs))
for i in range(0, len(subs), 1):
	print(subs[i])


(n, p, q) = map(int, input().split())
s = input()
l = list()
while len(s):
	if len(s) % p != 0 and len(s) >= q:
		l.append(s[0:q])
		s = s[q:]
	elif len(s) % p == 0 and len(s) >= p:
		l.append(s[0:p])
		s = s[p:]
	else:
		break
if len(s):
	print(-1)
else:
	print(len(l))
	for x in l:
		print(x)


import sys
if False:
	inp = open('A.txt', 'r')
else:
	inp = sys.stdin
(n, p, q) = map(int, inp.readline().split())
string = inp.readline().strip()
length = n
ans = -1
for i in range(n // p + 1):
	length = n - p * i
	if length % q == 0:
		ans = i
		break
if ans == -1:
	print(-1)
else:
	print(ans + length // q)
	for i in range(ans):
		print(string[:p])
		string = string[p:]
	for i in range(length // q):
		print(string[:q])
		string = string[q:]


from math import ceil
(n, p, q) = map(int, input().split())
s = input()
if p == n or q == n:
	print(f'1\n{s}')
else:
	if p > q:
		(p, q) = (q, p)
	P = ceil(n / p)
	Q = ceil(n / q)
	cnts = [-1, -1]
	i = P
	while i >= 0:
		_sum = p * i
		j = 0
		while j <= Q and _sum < n:
			_sum += q
			j += 1
		if _sum == n:
			cnts = [i, j]
			break
		i -= 1
	if _sum == n:
		cnts = [i, j]
	if cnts[0] == -1:
		print(-1)
	else:
		print(sum(cnts))
		_i = 0
		for i in range(cnts[0]):
			print(s[_i:_i + p])
			_i += p
		for j in range(cnts[1]):
			print(s[_i:_i + q])
			_i += q


(n, p, q) = list(map(int, input().split(' ')))
s = input()
c = -1
for i in range(n + 1):
	for j in range(n + 1):
		if p * i + q * j == n:
			c = i
			d = j
			break
	if c != -1:
		break
if c == -1:
	print(-1)
else:
	print(c + d)
	for i in range(c):
		print(s[p * i:p * (i + 1)])
	e = c * p
	for j in range(d):
		print(s[e + q * j:e + q * (j + 1)])


lectura = lambda : map(int, input().split())
(n, p, q) = lectura()
palabra = input()
prioridad = -1
prio2 = -1
for i in range(0, len(palabra) // p + 1):
	if (len(palabra) - p * i) % q == 0:
		prioridad = i
		prio2 = (len(palabra) - p * i) // q
		break
if prioridad == -1:
	print(-1)
else:
	print(prioridad + prio2)
	for i in range(0, prioridad):
		inicio = i * p
		final = (i + 1) * p
		print(palabra[inicio:final])
	for i in range(0, prio2):
		inicio = prioridad * p + i * q
		final = prioridad * p + (i + 1) * q
		print(palabra[inicio:final])


(n, m, k) = map(int, input().split())
ch = input()

def haha(n, p, q, s):
	for a in range(n // p + 1):
		if (n - a * p) % q == 0:
			b = (n - a * p) // q
			print(a + b)
			for pos in range(0, a * p, p):
				print(s[pos:pos + p])
			for pos in range(a * p, n, q):
				print(s[pos:pos + q])
			return
	print(-1)
haha(n, m, k, ch)


(n, p, q) = map(int, input().split())
s = input()

def problem6(n, p, q, s):
	cont = 0
	cont2 = 0
	j = 0
	while n >= 0:
		if n % p == 0:
			break
		cont += 1
		n -= q
	if n < 0:
		print('-1')
		return
	cont2 = int(n / p)
	num = cont + cont2
	print(num)
	for i in range(cont2):
		print(s[j:j + p])
		j += p
	for i in range(cont):
		print(s[j:j + q])
		j += q
problem6(n, p, q, s)


from collections import defaultdict

def main():
	(n, p, q) = map(int, input().split())
	s = input()
	exsited = set()
	for i in range(0, n + 1, p):
		rem = (n - i) % q
		if rem == 0:
			front = s[:i]
			back = s[i:]
			ss = [front[j:j + p] for j in range(0, i, p)] + [back[j:j + q] for j in range(0, n - i, q)]
			print(len(ss))
			print('\n'.join(ss))
			return
		if rem in exsited:
			break
		exsited.add(rem)
	print(-1)
main()


(n, p, q) = map(int, input().split())
strValue = input()
(p1, q1, Xc) = (0, 0, 0)
if n % p == 0:
	p1 = n // p
elif n % q == 0:
	q1 = n // q
elif n / p > 1:
	Xa = n % p
	p1 = n // p
	while p1 > 0 and q1 == 0:
		m = n - p * p1
		if m % q == 0:
			q1 = m // q
		else:
			p1 = p1 - 1
	if p1 == 0:
		Xc = -1
if Xc == -1:
	print(Xc)
else:
	print(p1 + q1)
	if p1 > 0:
		strV1 = strValue[:p1 * p]
		fl = [strV1[a:a + p] for a in range(0, p1 * p, p)]
		for a in fl:
			print(''.join(a))
	if q1 > 0:
		strV1 = strValue[p1 * p:]
		fll = [strV1[a:a + q] for a in range(0, q1 * q, q)]
		for a in fll:
			print(''.join(a))


(n, p, q) = map(int, input().split())
nn = n
a = input()
if p + q == n:
	print(2)
	print(a[0:p])
	print(a[p:])
elif p + q < n:
	num = max(p, q)
	while n % min(p, q) != 0 and n >= 0:
		n -= num
	if n >= 0 and n % min(p, q) == 0:
		d = {max(p, q): (nn - n) // max(p, q), min(p, q): n // min(p, q)}
		print(sum(d.values()))
		(x, y) = (max(p, q), min(p, q))
		(i, j) = (0, 0)
		while d[x] != 0:
			print(a[i:x + i])
			i += x
			d[x] -= 1
		j += i
		while d[y] != 0:
			print(a[j:y + j])
			j += y
			d[y] -= 1
	else:
		print(-1)
elif n % p == 0:
	print(n // p)
	for i in range(p, n + 1, p):
		print(a[i - p:i])
elif n % q == 0:
	print(n // q)
	for i in range(q, n + 1, q):
		print(a[i - q:i])
else:
	print(-1)


(n, p, q) = map(int, input().split())
s = input()

def main(n, p, q):
	edge = n // q + 1
	for i in range(edge):
		if (n - i * q) % p == 0:
			return ((n - i * q) // p, i)
	return (-1, -1)
(i, k) = main(n, p, q)
if i != -1:
	print(i + k)
	for t in range(i):
		print(s[p * t:p * (t + 1)])
	for t in range(k):
		print(s[p * i + q * t:p * i + q * (t + 1)])
else:
	print(-1)


(n, p, q) = map(int, input().split())
string = input()
for i in range(101):
	for j in range(101):
		if p * i + q * j == n:
			print(i + j)
			for idx in range(i):
				print(string[idx * p:(idx + 1) * p])
			for idx in range(j):
				print(string[p * i + idx * q:p * i + (idx + 1) * q])
			exit(0)
print(-1)


(n, p, q) = map(int, input().split())
s = input()
for i in range(n // p + 1):
	for j in range(n // q + 1):
		if n == p * i + q * j:
			print(i + j)
			if i > 0:
				print('\n'.join((s[k * p:(k + 1) * p] for k in range(i))))
			if j > 0:
				print('\n'.join((s[p * i + k * q:p * i + (k + 1) * q] for k in range(j))))
			exit()
print(-1)


(n, p, q) = map(int, input().split())
s = input()
h = 0
for i in range(len(s)):
	for j in range(len(s)):
		if i * p + j * q == n:
			print(i + j)
			ch = ''
			for k in range(i):
				for l in range(k * p, (k + 1) * p):
					ch = ch + s[l]
				print(ch)
				ch = ''
			z = ''
			l = 0
			k = 0
			for k in range(j):
				for l in range(i * p + k * q, (k + 1) * q + i * p):
					z = z + s[l]
				print(z)
				z = ''
			h = 1
			break
	if h == 1:
		break
if h == 0:
	if n == p or n == q:
		print(1)
		print(s)
	else:
		print(-1)


(n, p, q) = [int(e) for e in input().split(' ')]
s = input()
solA = -1
solB = -1
for i in range(0, n // p + 1):
	if (n - p * i) % q == 0:
		solA = i
		solB = (n - p * i) // q
		break
if solA == -1:
	print(-1)
else:
	print(solA + solB)
	for i in range(0, solA):
		print(s[i * p:(i + 1) * p])
	for i in range(0, solB):
		print(s[solA * p + i * q:solA * p + (i + 1) * q])


(a, b, c) = map(int, input().split(' '))
x = input()
for i in range(105):
	for j in range(105):
		if i * b + j * c == a:
			print(i + j)
			for k in range(i):
				print(x[:b])
				x = x[b:]
			for l in range(j):
				print(x[:c])
				x = x[c:]
			quit()
print(-1)


import sys
first = input().split()
x = int(first[0])
a = int(first[1])
b = int(first[2])
txt = input()
results = []

def dividirParejo(txt, z, until, cant):
	print(until + cant)
	p = 0
	x = 0
	i = 0
	while i < until:
		results.append(txt[x:p + z])
		p = p + z
		x = p
		i = i + 1
	for p in results:
		print(p)

def aver(txt, A, B):
	if A > B:
		a = B
		b = A
	else:
		a = A
		b = B
	cant = 0
	state = 4
	inicio = 0
	while state == 4:
		if a + b == len(txt) - inicio:
			cant = cant + 2
			results.append(txt[inicio:inicio + a])
			results.append(txt[inicio + a:inicio + a + b])
			state = 3
		elif len(txt) - inicio < 0:
			state = 2
			print(-1)
		elif (len(txt) - inicio) % a == 0:
			state = 5
			z = (len(txt) - inicio) // a
			dividirParejo(txt[inicio:len(txt)], a, z, cant)
		elif (len(txt) - inicio) % b == 0:
			state = 5
			z = (len(txt) - inicio) // b
			dividirParejo(txt[inicio:len(txt)], b, z, cant)
		else:
			cant = cant + 1
			results.append(txt[inicio:inicio + a])
			inicio = inicio + a
		if state == 3:
			print(cant)
			for p in results:
				print(p)
if x % a == 0:
	z = x // a
	dividirParejo(txt, a, z, 0)
elif x % b == 0:
	z = x // b
	dividirParejo(txt, b, z, 0)
else:
	aver(txt, a, b)


(n, p, q) = map(int, input().split())
str = input()
rp = n // p + 1
rq = n // q + 1
for i in range(rp):
	for j in range(rq):
		total = i * p + j * q
		if total == n:
			print(i + j)
			ult = 0
			for k in range(i):
				print(str[k * p:(k + 1) * p])
				ult = (k + 1) * p
			for k in range(j):
				print(str[k * q + ult:(k + 1) * q + ult])
			exit(0)
print('-1')


from collections import *
from itertools import *
from random import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from re import *
from sys import *

def fast():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in fast().split()]
(z, zz) = (input, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer):
	stdout.write(str(answer))
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
arr = zzz()
n = int(arr[0])
numBank = arr[1:]
lst = [None] * (n + 1)
lst[0] = []
arr = fast()
for i in range(n):
	if lst[i] != None:
		for j in numBank:
			try:
				if lst[i + j] == None:
					lst[i + j] = lst[i] + [j]
			except:
				pass
if lst[n] == None:
	print(-1)
	exit()
print(len(lst[n]))
j = 0
for i in lst[n]:
	print(arr[j:j + i])
	j += i


def solve():
	(n, p, q) = [int(a) for a in input().split()]
	s = input()
	for a in range(len(s)):
		if len(s) - a * p < 0:
			break
		if (len(s) - a * p) % q == 0:
			b = (len(s) - a * p) // q
			ctr = 0
			ans = []
			for i in range(a):
				ans.append(s[ctr:ctr + p])
				ctr += p
			for i in range(b):
				ans.append(s[ctr:ctr + q])
				ctr += q
			print(len(ans))
			for x in ans:
				print(x)
			return
	print(-1)
solve()


(n, xs, ys) = map(int, input().split())
s = input()
for x in range(n // xs + 1):
	if (n - x * xs) % ys == 0:
		y = (n - x * xs) // ys
		print(x + y)
		for i in range(x):
			print(s[i * xs:(i + 1) * xs])
		s = s[x * xs:len(s)]
		for j in range(y):
			print(s[j * ys:(j + 1) * ys])
		exit()
print(-1)


def fun(a, b, c, arr):
	x = 0
	y = 1
	while a - b * x > 0:
		y = (a - b * x) % c
		if y == 0:
			break
		x = x + 1
	y = (a - b * x) // c
	if x * b + y * c != a or x < 0 or y < 0:
		print(-1)
		return
	print(x + y)
	for i in range(0, x * b, b):
		for j in range(i, i + b):
			print(arr[j], end='')
		print()
	for i in range(b * x, a, c):
		for j in range(i, i + c):
			print(arr[j], end='')
		print()
(a, b, c) = [int(x) for x in input().split()]
arr = input()
fun(a, b, c, arr)


(a, b, c) = map(int, input().split())
z = input()
for i in range(0, 101, b):
	for j in range(0, 101, c):
		if i + j == a:
			print(i // b + j // c)
			f = 0
			k = i // b
			k1 = j // c
			i = 0
			while k or k1:
				if k:
					print(z[f:f + b])
					f += b
					k -= 1
				else:
					print(z[f:f + c])
					f += c
					k1 -= 1
			exit()
print(-1)


(n, p, q) = map(int, input().split())
s = input()
a = ''
for x in range(100 // p + 2):
	for y in range(100 // q + 2):
		if p * x + q * y == n:
			print(x + y)
			for a in range(x):
				print(s[a * p:(a + 1) * p])
			s = s[x * p:]
			for b in range(y):
				print(s[b * q:(b + 1) * q])
			quit()
else:
	print(-1)


(n, p, q) = map(int, input().split(' '))
s = input()
asdf = False
for i in range(n // p + 1):
	for j in range((n - i * p) // q + 1):
		if i * p + j * q == n and asdf == False:
			print(i + j)
			asdf = True
			for a in range(i):
				print(s[a * p:(a + 1) * p])
			for b in range(j):
				print(s[p * i + b * q:p * i + (b + 1) * q])
if asdf == False:
	print(-1)


def main():
	(n, p, q) = map(int, input().split())
	s = input()
	for i in range(0, n + 1):
		for j in range(0, n + 1):
			if p * i + q * j == n:
				print(i + j)
				for k in range(i):
					print(s[:p])
					s = s[p:]
				for k in range(j):
					print(s[:q])
					s = s[q:]
				return 0
	print(-1)
	return 0
main()


(a, b, c) = map(int, input().split())
nome = input()
i = 1
f = 0
g = 0
val = 1
if a % b == 0:
	val = 0
	print(a // b)
	for i in range(a // b):
		print(nome[f:b + f])
		f += b
elif a % c == 0:
	val = 0
	print(a // c)
	for i in range(a // c):
		print(nome[f:c + f])
		f += c
else:
	while True:
		valor = a - i * b
		if valor <= 0:
			break
		if valor % c == 0:
			val = 0
			print(i + valor // c)
			for x in range(i):
				print(nome[f:f + b])
				f += b
			for y in range(valor // c):
				print(nome[f:f + c])
				f += c
			break
		i += 1
if val:
	print('-1')


(n, p, q) = map(int, input().split())
s = list(input())
f = 0
for i in range(101):
	if f:
		break
	for j in range(101):
		if p * i + q * j == n:
			ans = []
			(l, r) = (0, 0)
			for _ in range(i):
				r += p
				ans.append(s[l:r])
				l += p
			for _ in range(j):
				r += q
				ans.append(s[l:r])
				l += q
			f = 1
			break
print(-1 if not f else len(ans))
if f:
	for t in ans:
		print(''.join(t))


import sys
(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
st = input()
for x in range(100):
	for y in range(100):
		if b * x + c * y == a:
			print(x + y)
			ind = 0
			for w in range(x):
				print(st[ind:ind + b])
				ind += b
			for w in range(y):
				print(st[ind:ind + c])
				ind += c
			sys.exit()
print(-1)


import math
(n, p, q) = tuple((int(x) for x in input().split()))
word = input()

def counts(n, p, q):
	for i in range(math.ceil((n + 1) / p)):
		if (n - p * i) % q == 0:
			return (i, (n - p * i) // q)
	return None

def solve(n, p, q, word):
	_counts = counts(n, p, q)
	if _counts == None:
		print(-1)
		return
	(i, j) = _counts
	print(i + j)
	for ii in range(i):
		print(word[ii * p:ii * p + p])
	for jj in range(j):
		print(word[i * p + jj * q:i * p + jj * q + q])
solve(n, p, q, word)


from math import sqrt

def main():
	(n, p, q) = [int(v) for v in input().split()]
	d = input()
	data = [-1 for _ in range(n + 102)]
	parent = [-1 for _ in range(n + 102)]
	data[0] = 1
	for i in range(0, n + 1):
		if data[i] != -1:
			data[i + p] = 1
			parent[i + p] = i
			data[i + q] = 1
			parent[i + q] = i
	if data[n] != 1:
		print(-1)
	else:
		res = []
		cur = n
		c = parent[n]
		while c != 0:
			res.append(d[c:cur])
			t = c
			cur = c
			c = parent[t]
		res.append(d[c:cur])
		print(len(res))
		for d in reversed(res):
			print(d)
main()


def main():
	items = input().split()
	n = int(items[0])
	p = int(items[1])
	q = int(items[2])
	s = input()
	A = int(n / p)
	for a in range(A + 1):
		forq = n - a * p
		if forq % q == 0:
			b = int(forq / q)
			print(a + b)
			for i in range(a):
				print(s[i * p:(i + 1) * p])
			for i in range(b):
				print(s[a * p + i * q:a * p + (i + 1) * q])
			return
	print(-1)

def __starting_point():
	main()
__starting_point()


def gaseste(a, b, n):
	gasit = False
	k = 0
	while k * a <= n and (not gasit):
		p = 0
		while p * b + k * a <= n and (not gasit):
			if p * b + k * a == n:
				gasit = True
			else:
				p += 1
		if not gasit:
			k += 1
	return (-1, -1) if not gasit else (k, p)
(n, p, q) = map(int, input().split())
s = input()
(a, b) = gaseste(p, q, n)
if (a, b) != (-1, -1):
	i = 0
	print(a + b)
	while a > 0:
		print(s[i:i + p])
		i += p
		a -= 1
	while b > 0:
		print(s[i:i + q])
		i += q
		b -= 1
else:
	print(-1)


import os
(n, a, b) = map(int, input().split())
s = input()
maxn = n // a
x = -1
for i in range(0, maxn + 1):
	tmp = n - a * i
	if tmp % b == 0:
		x = i
		break
if x != -1:
	print(x + (n - a * x) // b)
	out = ''
	for i in range(0, x):
		out = s[a * i:(i + 1) * a]
		print(out)
	y = (n - a * x) // b
	for i in range(0, y):
		out = s[b * i + a * x:(i + 1) * b + a * x]
		print(out)
else:
	print('-1')


(n, p, q) = map(int, input().split())
s = input()
for i in range(n // p + 1):
	for j in range(n // q + 1):
		if i * p + j * q == n:
			print(i + j)
			x = 0
			cnt = 0
			while cnt < i:
				print(s[x:x + p])
				x += p
				cnt += 1
			cnt = 0
			while cnt < j:
				print(s[x:x + q])
				x += q
				cnt += 1
			exit()
print('-1')


(a, b, c) = map(int, input().split())
d = input()
e = []
for i in range(100):
	for j in range(100):
		if i * b + j * c == a:
			e = [i, j]
if e != []:
	print(sum(e))
	runTot = 0
	for k in range(e[0]):
		print(d[runTot:runTot + b])
		runTot += b
	for l in range(e[1]):
		print(d[runTot:runTot + c])
		runTot += c
else:
	print('-1')


(n, p, q) = list(map(int, input().split()))
s = input()
f = False
for i in range(len(s) // p + 1):
	r = p * i
	if (len(s) - r) % q == 0 and (len(s) - r) // q > 0:
		f = True
		c = 0
		print(i + (len(s) - r) // q)
		for i in range(1, i + 1):
			print(s[c:c + p])
			c += p
		for i in range(1, len(s) - r // q + 1):
			print(s[c:c + q])
			c += q
		break
	if len(s) % p == 0:
		f = True
		print(len(s) // p)
		print(*[s[i:i + p] for i in range(0, len(s), p)], sep='\n')
		break
	if len(s) % q == 0:
		f = True
		print(len(s) // q)
		print(*[s[i:i + q] for i in range(0, len(s), q)], sep='\n')
if not f:
	print(-1)


def main():
	(n, p, q) = map(int, input().split())
	ch = input()
	d = 0
	test = False
	for i in range(100):
		for j in range(100):
			if i * p + j * q == n:
				(pp, qq) = (i, j)
				test = True
				break
		if test:
			break
	if test == False:
		print(-1)
	else:
		print(pp + qq)
		for i in range(pp):
			print(ch[d:d + p])
			d += p
		for i in range(qq):
			print(ch[d:d + q])
			d += q
main()


def solve(x, y, kappa, keepo, s):
	print(kappa + keepo)
	idx = 0
	v = [(kappa, x), (keepo, y)]
	for i in v:
		for j in range(i[0]):
			current = ''
			for k in range(i[1]):
				current += s[idx]
				idx += 1
			print(current)
	exit(0)

def swap(a, b):
	return (b, a)

def main():
	s = input()
	s = s.split(' ')
	n = int(s[0])
	x = int(s[1])
	y = int(s[2])
	s = input()
	for i in range(100 + 1):
		for j in range(100 + 1):
			if i * x + j * y == n:
				solve(x, y, i, j, s)
	print('-1')
main()


import sys
(n, p, q) = map(int, input().split())
s = input()
for i in range(101):
	if p * i <= n and (n - p * i) % q == 0:
		x = i
		y = (n - p * i) // q
		print(x + y)
		j = 0
		for _ in range(x):
			print(s[j:j + p])
			j += p
		for _ in range(y):
			print(s[j:j + q])
			j += q
		break
else:
	print(-1)


def function(n, p, q, string):
	if n % p == 0:
		print(int(n / p))
		for i in range(0, len(string), p):
			print(string[i:i + p])
	elif n % q == 0:
		print(int(n / q))
		for i in range(0, len(string), q):
			print(string[i:i + q])
	else:
		if p < q:
			val_1 = q
			val_2 = p
		else:
			val_1 = p
			val_2 = q
		aux = n
		rep_1 = 0
		while val_1 < aux:
			aux -= val_1
			rep_1 += 1
			if aux % val_2 == 0:
				rep_2 = int(aux / val_2)
				print(rep_1 + rep_2)
				for i in range(0, val_1 * rep_1, val_1):
					print(string[i:i + val_1])
				for i in range(val_1 * rep_1, len(string), val_2):
					print(string[i:i + val_2])
				return
		print(-1)
(n, p, q) = [int(s) for s in input().split()]
string = input()
function(n, p, q, string)


import os
(n, p, q) = map(int, input().split())
s = input()
z = 0
for i in range(0, n + 1):
	if (n - i * p) % q == 0 and n - i * p >= 0:
		print(i + (n - i * p) // q)
		k = 0
		for j in range(i):
			print(s[k:k + p])
			k += p
		for j in range((n - i * p) // q):
			print(s[k:k + q])
			k += q
		z = 1
		break
if z == 0:
	print('-1')


import sys
(n, p, q) = map(int, input().split())
s = str(input())
k = 0
for a in range(101):
	for b in range(101):
		if a * p + b * q == n:
			n = -1
			print(a + b)
			for i in range(a):
				print(s[:p])
				s = s[p:]
			for i in range(b):
				print(s[:q])
				s = s[q:]
if n != -1:
	print(-1)


(n, p, q) = map(int, input().split())
s = str(input())
for i in range(101):
	for j in range(101):
		if p * i + q * j == n:
			ans = []
			for k in range(i):
				ans.append(s[p * k:p * (k + 1)])
			for l in range(j):
				ans.append(s[p * i + q * l:p * i + q * (l + 1)])
			print(len(ans))
			for m in range(len(ans)):
				print(ans[m])
			exit()
else:
	print(-1)


a = [int(i) for i in input().split(' ')]
s = input()
(n, p, q) = (a[0], a[1], a[2])
(y, x, m) = (-1, -1, 0)
for i in range(n // p + 1):
	if (n - p * i) % q == 0:
		x = i
		y = (n - p * i) // q
if y != -1 or x != -1:
	print(x + y)
	while x > 0:
		x -= 1
		print(s[m:m + p])
		m += p
	while y > 0:
		y -= 1
		print(s[m:m + q])
		m += q
else:
	print(-1)


import sys
from bisect import bisect_right as rb
from collections import deque
from queue import PriorityQueue
from math import *
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7
(n, p, q) = il()
s = ip()
for i in range(102):
	for j in range(102):
		if p * i + q * j == n:
			print(i + j)
			m = 0
			for k in range(i):
				print(s[m:m + p])
				m += p
			for k in range(j):
				print(s[m:m + q])
				m += q
			exit(0)
print(-1)


(n, p, q) = map(int, input().split())
s = input()
for i in range(111):
	for j in range(111):
		if p * i + q * j == n:
			n = -1
			print(i + j)
			for l in range(i):
				print(s[:p])
				s = s[p:]
			for l in range(j):
				print(s[:q])
				s = s[q:]
if n != -1:
	print(-1)


def print_string_segments(s, p, p_num, q, q_num):
	l = []
	for i in range(p_num):
		l.append(s[p * i:p * (i + 1)])
	for i in range(q_num):
		l.append(s[p * p_num + q * i:p * p_num + q * (i + 1)])
	print(len(l))
	for st in l:
		print(st)
(n, p, q) = [int(i) for i in input().split()]
s = input()
flag = 0
if n % p == 0:
	p_num = n // p
	q_num = 0
	flag = 1
elif n % q == 0:
	p_num = 0
	q_num = n // q
	flag = 1
else:
	for multiplier in range(1, n // p + 1):
		if (n - multiplier * p) % q == 0:
			p_num = multiplier
			q_num = (n - multiplier * p) // q
			flag = 1
if flag:
	print_string_segments(s, p, p_num, q, q_num)
else:
	print(-1)


def gpc(n, a, b):
	for (i, ii) in enumerate(range(0, n + 1, a)):
		for (j, jj) in enumerate(range(0, n + 1, b)):
			if ii + jj == n:
				return (i, j)
	return None
(n, p, q) = map(int, input().split())
s = input()
r = gpc(n, p, q)
if r == None:
	print(-1)
else:
	print(sum(r))
	for i in range(r[0]):
		print(s[i * p:(i + 1) * p])
	for i in range(r[1]):
		print(s[i * q + p * r[0]:(i + 1) * q + p * r[0]])


def ft():
	(n, p, q) = map(int, input().split())
	ch = input()
	for k in range(n):
		if n - k * p < 0:
			break
		if (n - k * p) % q == 0:
			z = (n - k * p) // q
			cp = 0
			T = []
			for i in range(k):
				T.append(ch[cp:cp + p])
				cp += p
			for i in range(z):
				T.append(ch[cp:cp + q])
				cp += q
			print(len(T))
			for j in T:
				print(j)
			return
	print(-1)
ft()


from functools import reduce
from operator import *
from math import *
from sys import *
from string import *
from collections import *
setrecursionlimit(10 ** 7)
dX = [-1, 1, 0, 0, -1, 1, -1, 1]
dY = [0, 0, -1, 1, 1, -1, -1, 1]
RI = lambda : list(map(int, input().split()))
RS = lambda : input().rstrip().split()
(n, p, q) = RI()
s = RS()[0]
for i in range(n // p + 1):
	if (n - i * p) % q == 0:
		print(i + (n - i * p) // q)
		for j in range(0, i * p, p):
			print(s[j:j + p])
		for j in range(i * p, n, q):
			print(s[j:j + q])
		exit(0)
print(-1)


import math
inp = input().split(' ')
n = int(inp[0])
a = int(inp[1])
b = int(inp[2])
x = 0
y = 0
BatasBawah = int(math.ceil(n / a))
BatasAtas = int(math.ceil(n / b))
s = input()
for i in range(0, BatasBawah + 1):
	for j in range(0, BatasAtas + 1):
		if n == a * i + b * j:
			x = i
			y = j
if x + y == 0:
	print('-1')
else:
	print(x + y)
	for i in range(0, x):
		for j in range(0, a):
			print(s[i * a + j], end='')
		print()
	for i in range(0, y):
		for j in range(0, b):
			print(s[x * a + j + b * i], end='')
		print()


(n, p, q) = input().split()
n = int(n)
p = int(p)
q = int(q)
s = input()
for i in range(100):
	for j in range(100):
		if i * p + j * q == n:
			print(i + j)
			last = 0
			for k in range(i):
				print(s[last:last + p])
				last = last + p
			for k in range(j):
				print(s[last:last + q])
				last = last + q
			exit()
print(-1)


import math

def euclid_algorithm(a, b):
	(t1, t2) = (abs(a), abs(b))
	(x1, y1, x2, y2) = (int(math.copysign(1, a)), 0, 0, int(math.copysign(1, b)))
	if t1 < t2:
		(t1, t2) = (t2, t1)
		(x1, y1, x2, y2) = (x2, y2, x1, y1)
	while t2 > 0:
		if x1 * a + y1 * b != t1:
			print('inshalla')
		k = int(t1 // t2)
		(t1, t2) = (t2, t1 % t2)
		(x1, y1, x2, y2) = (x2, y2, x1 - k * x2, y1 - k * y2)
	return (t1, x1, y1)

def opposite_element(x, p):
	(gcd, k, l) = euclid_algorithm(x, p)
	if gcd != 1:
		return -1
	return k % p

def fact_mod(n, p):
	prod = 1
	for i in range(2, n + 1):
		prod *= i
		prod %= p
	return prod
(n, p, q) = [int(x) for x in input().split()]
s = input().rstrip()
for i in range(n // p + 1):
	if (n - p * i) % q == 0:
		j = (n - p * i) // q
		print(i + j)
		for k in range(i):
			print(s[k * p:(k + 1) * p])
		for k in range(j):
			print(s[p * i + k * q:p * i + (k + 1) * q])
		break
else:
	print(-1)


(n, p, q) = map(int, input().split())
s = input()
f = True
x = 0
y = 0
for i in range(n + 1):
	for j in range(n + 1):
		if i * p + j * q == n:
			x = i
			y = j
			f = False
			break
	if not f:
		break
if f:
	print(-1)
else:
	print(x + y)
	for i in range(x):
		print(s[i * p:(i + 1) * p])
	for j in range(y):
		print(s[x * p + q * j:x * p + q * (j + 1)])


(n, a, b) = map(int, input().split())
s = input()
(k1, k2) = (0, 0)
for i in range(n + 1):
	for j in range(n + 1):
		if i * a + j * b == n:
			k1 = i
			k2 = j
			break
	if k1 or k2:
		break
else:
	print('-1')
if k1 or k2:
	print(k1 + k2)
	i = 0
	while k1:
		print(s[i:i + a])
		k1 -= 1
		i += a
	while k2:
		print(s[i:i + b])
		k2 -= 1
		i += b


(n, p, q) = map(int, input().split())
ch = input()
i = 0
j = 0
s = 0
for i in range(0, 100):
	for j in range(0, 100):
		if i * p + q * j == n:
			break
	if i * p + q * j == n:
		break
if i < 99 or j < 99:
	print(i + j)
	for z in range(0, i):
		print(ch[s:s + p])
		s = s + p
	for k in range(0, j):
		print(ch[s:s + q])
		s = s + q
else:
	print(-1)


(n, p, q) = map(int, input().split())
s = input()
k = 0
l = 0
r = 0
for i in range(n + 1):
	for j in range(n + 1):
		if i * p + j * q == n:
			r += 1
			print(i + j)
			while k < i:
				print(s[k * p:p * (k + 1)])
				k += 1
			while l < j:
				print(s[p * (k + 1) + l * q - p:p * (k + 1) + (l + 1) * q - p])
				l += 1
		if r >= 1:
			break
	if r >= 1:
		break
if r == 0:
	print('-1')


x = input()
(l, f, s) = x.split()
l = int(l)
f = int(f)
s = int(s)
string = input()
flag = True
for i in range(100):
	if l % f == 0:
		flag = False
		print(l // f)
		n = 0
		m = f
		for j in range(l // f):
			print(string[n:m])
			n = m
			m += f
		exit(0)
for i in range(100):
	if l % s == 0:
		flag = False
		print(l // s)
		n = 0
		m = s
		for j in range(l // s):
			print(string[n:m])
			n = m
			m += s
		exit(0)
for i in range(1, 100):
	for j in range(1, 100):
		if l == i * f + j * s:
			flag = False
			print(i + j)
			n = 0
			m = f
			for q in range(i):
				print(string[n:m])
				n = m
				m += f
			m = n + s
			for q in range(j):
				print(string[n:m])
				n = m
				m += s
			exit(0)
if flag:
	print(-1)


def textSplitting(n, p, q, s):
	size = n
	cuenta = 0
	while size >= 0:
		if size % p == 0:
			break
		cuenta += 1
		size -= q
	if size < 0:
		print(-1)
		return
	cuenta2 = size // p
	print(cuenta + cuenta2)
	indx = 0
	for i in range(cuenta2):
		print(s[indx:indx + p])
		indx += p
	for i in range(cuenta):
		print(s[indx:indx + q])
		indx += q
	return
a = input().split()
n = int(a[0])
p = int(a[1])
q = int(a[2])
s = input()
textSplitting(n, p, q, s)


(n, p, q) = map(int, input().split())
s = list(input())
if n % q == 0:
	count = n // q
	print(count)
	i = 0
	while i < n:
		print(''.join(s[i:i + q]))
		i = i + q
elif n % p == 0:
	count = n // p
	print(count)
	i = 0
	while i < n:
		print(''.join(s[i:i + p]))
		i = i + p
else:
	c = n // p
	flag = 0
	for i in range(1, c + 1):
		if ((n - p * i) / q).is_integer():
			flag = 1
			j = int((n - p * i) / q)
			print(i + j)
			break
	if flag == 0:
		print(-1)
	else:
		count = 0
		t = 0
		while count < i:
			print(''.join(s[t:t + p]))
			t = t + p
			count = count + 1
		count = 0
		while count < j:
			print(''.join(s[t:t + q]))
			t = t + q
			count = count + 1


(a, b, c) = map(int, input().split())
s = input()
n1 = -1
n2 = -1
for i in range(102):
	if a - b * i == 0:
		n1 = i
		n2 = 0
		break
	if a - b * i > 0:
		if (a - b * i) % c == 0:
			n1 = i
			n2 = (a - b * i) // c
if n1 == -1:
	print(-1)
	exit()
ind = 0
print(n1 + n2)
for i in range(n1):
	print(s[ind:ind + b])
	ind += b
for i in range(n2):
	print(s[ind:ind + c])
	ind += c


(n, p, q) = [int(x) for x in input().split()]
s = input()
done = False
for i in range(1 + n // p):
	if (n - i * p) % q == 0:
		print(i + (n - i * p) // q)
		for x in range(i):
			print(s[x * p:(x + 1) * p])
		for x in range((n - i * p) // q):
			print(s[i * p + x * q:i * p + (x + 1) * q])
		done = True
		break
if not done:
	print(-1)


(n, p, q) = list(map(int, input().split()))
s = input().strip()
fps = [x * p for x in range(n // p + 1)]
fqs = [x * q for x in range(n // q + 1)]
for fp in fps:
	for fq in fqs:
		if fp + fq == n:
			ps = fps.index(fp)
			qs = fqs.index(fq)
			start = 0
			end = 0
			print(ps + qs)
			for i in range(1, n + 1):
				if start >= n:
					break
				if i <= ps:
					end += p
				else:
					end += q
				print(s[start:end])
				start = end
			exit()
print(-1)


from sys import argv, exit

def rstr():
	return input()

def rint():
	return int(input())

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

def prnt(*args):
	if '-v' in argv:
		print(*args)

def shieldthing(n, p, q):
	shield = n
	eb = p
	iv = q
	ebn = 0
	ivn = 0
	while shield > 0:
		if shield % iv == 0:
			ivn = shield / iv
			return (ebn, ivn)
		shield -= eb
		ebn += 1
	if shield == 0:
		return (ebn, ivn)
	return (-1, -1)
(n, p, q) = rints()
s = rstr()
(pn, qn) = shieldthing(n, p, q)
if pn == -1:
	print('-1')
	exit(0)
print(int(pn + qn))
i = 0
while pn > 0:
	print(s[i:i + p])
	i = i + p
	pn -= 1
while qn > 0:
	print(s[i:i + q])
	i = i + q
	qn -= 1


(n, p, q) = map(int, input().split())
s = list(input())

def printRes(split, l, r):
	output = []
	i = 0
	c = l
	while i < n:
		output.append(s[i:i + c])
		i += c
		if i >= split:
			c = r
	print(len(output))
	for chars in output:
		print(''.join(chars))
if n % p == 0:
	printRes(n, p, q)
elif n % q == 0:
	printRes(n, q, p)
elif n < p + q:
	print(-1)
else:
	split = -1
	i = p
	while i < n:
		if (n - i) % q == 0:
			split = i
			break
		i += p
	if split != -1:
		printRes(split, p, q)
	else:
		i = q
		while i < n:
			if (n - i) % p == 0:
				split = i
				break
			i += q
		if split != -1:
			printRes(split, q, p)
	if split == -1:
		print(-1)


import sys
(n, p, q) = map(int, input().split())
s = input()
for i in range(0, 101):
	for j in range(0, 101):
		if p * i + q * j == n:
			print(i + j)
			for o in range(0, i):
				print(s[o * p:(o + 1) * p])
			s = s[i * p:]
			for o in range(0, j):
				print(s[o * q:(o + 1) * q])
			sys.exit()
print(-1)


(n, p, q) = map(int, input().split())
s = input()
if n >= min(p, q):
	mini = min(p, q)
	maxi = max(p, q)
	rem = n % mini
	a = n // mini
	diff = maxi - mini
	if diff != 0:
		if rem != 0:
			if rem >= diff:
				if rem % diff == 0:
					b = rem // diff
					if b <= a:
						a = a - b
						print(a + b)
						for i in range(a):
							print(s[0:mini])
							s = s[mini:len(s)]
						for i in range(b):
							print(s[0:maxi])
							if len(s) != 0:
								s = s[maxi:len(s)]
							else:
								pass
					else:
						print('-1')
				else:
					while a > 0:
						if rem % maxi == 0:
							b = rem // maxi
							print(a + b)
							for i in range(a):
								print(s[0:mini])
								s = s[mini:len(s)]
							for i in range(b):
								print(s[0:maxi])
								s = s[maxi:len(s)]
							break
						else:
							rem += mini
							a -= 1
					else:
						print(-1)
			else:
				rem = n % maxi
				a = n // maxi
				while a > 0:
					if rem % mini == 0:
						b = rem // mini
						print(a + b)
						for i in range(a):
							print(s[0:maxi])
							s = s[maxi:len(s)]
						for i in range(b):
							print(s[0:mini])
							if len(s) != 0:
								s = s[mini:len(s)]
							else:
								pass
						break
					else:
						rem += maxi
						a -= 1
				else:
					print(-1)
		else:
			print(a)
			for i in range(a):
				print(s[0:mini])
				s = s[mini:len(s)]
	elif n % p == 0:
		print(n // p)
		for i in range(n // p):
			print(s[0:p])
			if len(s) != 0:
				s = s[p:len(s)]
			else:
				pass
	else:
		print(-1)
else:
	print(-1)


(n, p, q) = list(map(int, input().split()))
s = input()
(p, q) = (max(p, q), min(p, q))
(a, b) = (-1, 0)
if n % p == 0:
	print(n // p)
	for i in range(n // p):
		print(s[i * p:(i + 1) * p])
elif n % q == 0:
	print(n // q)
	for i in range(n // q):
		print(s[i * q:(i + 1) * q])
else:
	for i in range(1, n // p + 1):
		if (n - i * p) % q == 0:
			(a, b) = (i, (n - i * p) // q)
			break
	if a == -1:
		print(-1)
	else:
		print(a + b)
		for i in range(a):
			print(s[i * p:(i + 1) * p])
		for i in range(b):
			print(s[a * p + i * q:a * p + (i + 1) * q])


npq = [int(i) for i in input().split()]
word = input()
for i in range(100):
	for j in range(100):
		if i * npq[1] + j * npq[2] == npq[0]:
			print(i + j)
			for k in range(i):
				print(word[:npq[1]])
				word = word[npq[1]:]
			for l in range(j):
				print(word[:npq[2]])
				word = word[npq[2]:]
			quit()
print(-1)


(n, p, q) = [int(x) for x in input().split()]
s = input()
l = 0
r = 0
k = 0
for i in range(101):
	for j in range(101):
		if i * p + j * q == n:
			l = i
			r = j
if l == 0 and r == 0:
	print('-1')
else:
	print(l + r)
	for i in range(l):
		print(s[p * i:p * i + p])
	s = s[p * l:]
	for i in range(r):
		print(s[q * i:q * i + q])


(n, p, q) = map(int, input().split(' '))
(p, q) = (max(p, q), min(p, q))
s = input()
n_ = n
np = 0
nq = 0
if n % p != 0:
	if n % q == 0:
		nq = int(n / q)
	else:
		while n % q != 0 and n > 0:
			np += 1
			n -= p
		nq += int(n / q)
else:
	np = int(n / p)
if np * p + nq * q != n_ or nq < 0:
	print('-1')
else:
	print(np + nq)
	index = 0
	for i in range(np):
		print(s[index:index + p])
		index += p
	for i in range(nq):
		print(s[index:index + q])
		index += q


import sys
import math
x = input().split()
length = int(x[0])
p = int(x[1])
q = int(x[2])
inStr = input()
outList = []
strlen = length
while strlen > 0:
	outList.append(min(p, q))
	strlen -= outList[-1]
	if strlen % max(p, q) == 0 and strlen > 0:
		while not strlen == 0:
			outList.append(max(p, q))
			strlen -= outList[-1]
if strlen != 0:
	strlen = length
	outList = []
	while strlen > 0:
		outList.append(max(p, q))
		strlen -= outList[-1]
		if strlen % min(p, q) == 0 and strlen > 0:
			while not strlen == 0:
				outList.append(min(p, q))
				strlen -= outList[-1]
if strlen != 0:
	print(-1)
else:
	print(len(outList))
	for i in outList:
		for count in range(strlen, strlen + i):
			print(inStr[count], end='', flush=True)
		strlen += i
		print()


import sys
(n, p, q) = map(int, input().split())
s = input()
for i in range(n // p + 1):
	v = n - i * p
	if v % q == 0:
		ans = []
		pos = 0
		for j in range(i):
			ans.append(s[pos:pos + p])
			pos += p
		for j in range(v // q):
			ans.append(s[pos:pos + q])
			pos += q
		print(len(ans))
		for j in ans:
			print(j)
		exit(0)
print(-1)


(n, p, q) = list(map(int, input().split()))
string = input()
split_string = lambda x, n: [x[i:i + n] for i in range(0, len(x), n)]

def func(n, p, q, string):
	words = []
	parts_p = 0
	parts_q = 0
	for i in range(0, len(string) + 1):
		for j in range(0, len(string) + 1):
			if i * p + j * q == n:
				parts_p = i
				parts_q = j
				break
	if parts_p * p + parts_q * q != n:
		print('-1')
		return
	words += split_string(string[:p * parts_p], p)
	words += split_string(string[p * parts_p:], q)
	print(len(words))
	for word in words:
		print(word)
func(n, p, q, string)


def pr(x):
	print(int(n / x))
	for i in range(int(n / x)):
		print(s[i * x:(i + 1) * x])
(n, p, q) = map(int, input().split())
s = input()
if n % p == 0:
	pr(p)
elif n % q == 0:
	pr(q)
else:
	for i in range(1, int(n / p) + 1):
		if (n - p * i) % q == 0:
			print(i + int((n - p * i) / q))
			for j in range(i):
				print(s[j * p:(j + 1) * p])
			for j in range(int((n - p * i) / q)):
				print(s[i * p + j * q:i * p + (j + 1) * q])
			break
	else:
		print('-1')


(n, p, q) = map(int, input().split())
s = input()
a = 0
if len(s) % p == 0:
	a = len(s) // p
	b = 0
else:
	for i in range(0, 200):
		rem = len(s) - a
		if rem % q == 0:
			a = a // p
			b = rem // q
			break
		if rem < 0:
			a = -1
			b = -1
			break
		a += p
if a < 0 or b < 0:
	print(-1)
else:
	print(a + b)
	for i in range(0, a):
		ss = s[0:p]
		print(ss)
		s = s[p:]
	for i in range(0, b):
		ss = s[0:q]
		print(ss)
		s = s[q:]


(n, p, q) = [int(i) for i in input().split()]
s = input()
(ps, qs) = (0, 0)
can = False
for i in range(n + 1):
	for j in range(n + 1):
		if i * p + j * q == n:
			(ps, qs) = (i, j)
			can = True
			break
if can:
	print(ps + qs)
	li = 0
	for i in range(0, ps * p, p):
		li = i
		print(s[i:i + p])
	for i in range(ps * p, n, q):
		print(s[i:i + q])
else:
	print(-1)


x = []
x = input().split()
n = int(x[0])
p = int(x[1])
q = int(x[2])
s = ''
s = str(input())
if q > p:
	y = p
	p = q
	q = y
a = int(n / p)
b = 200
for x in range(a, -1, -1):
	if (n - x * p) % q == 0:
		a = x
		b = int((n - x * p) / q)
		break
if b != 200:
	print(int(a + b))
	for x in range(a):
		print(s[x * p:p * (x + 1)])
	for y in range(b):
		print(s[a * p + y * q:q * (y + 1) + a * p])
else:
	print(-1)


(n, p, q) = map(int, input().split())
s = input()
ansp = 0
ansq = 0
z = 0
for i in range(int(n / p) + 1):
	if (n - i * p) % q == 0:
		ansp = i
		ansq = (n - i * p) // q
		z = 1
		break
if z == 0:
	print('-1')
else:
	k = 0
	print(ansq + ansp)
	while (ansp == 0) + (ansq == 0) != 2:
		if ansp != 0:
			print(s[k:k + p])
			ansp -= 1
			k = k + p
		else:
			print(s[k:k + q])
			k = k + q
			ansq -= 1


(n, p, q) = map(int, input().split())
s = input()
dp = [0] * (n + 1)
dp[0] = 1
ans = []
for i in range(n + 1):
	if i - q >= 0 and dp[i - q]:
		dp[i] = q
	if i - p >= 0 and dp[i - p]:
		dp[i] = p
if dp[n] == 0:
	print(-1)
else:
	j = n
	while j > 0 and dp[j] != 0:
		ans.append(dp[j])
		j = j - dp[j]
	print(len(ans))
	st = 0
	for i in ans:
		print(s[st:st + i])
		st += i


def equalsplit(word, p):
	while len(word) > 0:
		subs.append(word[:p])
		word = word[p:]
args = input().split()
n = eval(args[0])
p = eval(args[1])
q = eval(args[2])
word = input()
subs = []
flag = False
if n % p == 0:
	equalsplit(word, p)
elif n % q == 0:
	equalsplit(word, q)
elif n < min(p, q) * 2:
	flag = True
else:
	mx = max(p, q)
	mn = min(p, q)
	while len(word) % mx != 0:
		subs.append(word[:mn])
		word = word[mn:]
		if len(word) < mx:
			flag = True
			break
	if not flag:
		equalsplit(word, mx)
if flag:
	print(-1)
else:
	print(len(subs))
	for each in subs:
		print(each)


(n, p, q) = list(map(int, input().split()))
s = input()
K1 = 0
K2 = 0
for k1 in range(n // p + 1):
	for k2 in range(n // q + 1):
		if p * k1 + q * k2 == n:
			K1 = k1
			K2 = k2
			break
if not K1 and (not K2):
	print(-1)
else:
	print(K1 + K2)
	i = 0
	while i < K1 * p:
		print(s[i:i + p])
		i += p
	while i < n:
		print(s[i:i + q])
		i += q


def gen(i):
	if i > n:
		return False
	if i == n:
		return True
	if i in mem:
		return False
	mem[i] = True
	if gen(i + p):
		L.append(s[i:i + p])
		return True
	if gen(i + q):
		L.append(s[i:i + q])
		return True
	return False
mem = {}
(n, p, q) = map(int, input().split())
s = input()
L = []
if gen(0):
	print(len(L))
	for i in range(len(L) - 1, -1, -1):
		print(L[i])
else:
	print(-1)


(n, p, q) = map(int, input().split())
s = input()
found = False
for k1 in range(100):
	if found:
		break
	for k2 in range(100):
		if found:
			break
		if k1 * p + k2 * q == len(s):
			ans = (k1, k2)
			found = True
if not found:
	print(-1)
	exit(0)
idx = 0
(k1, k2) = ans
print(k1 + k2)
while k1:
	print(s[idx:idx + p])
	idx += p
	k1 -= 1
while k2:
	print(s[idx:idx + q])
	idx += q
	k2 -= 1


def yo(ma, mi, n, s):
	main1 = n // ma
	main2 = n // mi
	flag = 0
	for i in range(main1, -1, -1):
		for j in range(0, main2 + 1):
			if ma * i + mi * j == n:
				flag = 1
				break
		if flag == 1:
			break
	main1 = i
	main2 = j
	if flag == 1:
		print(main1 + main2)
		t = 0
		for i in range(main1):
			print(s[t:t + ma])
			t += ma
		for i in range(main2):
			print(s[t:t + mi])
			t += mi
	else:
		print(-1)
	return ''
(n, p, q) = map(int, input().split())
s = input()
ma = max(p, q)
mi = min(p, q)
print(yo(ma, mi, n, s))


(n, p, q) = map(int, input().split())
s = input()
F = [0] * (n + 1 + max(p, q))
F[0] = 1
Prev = [0] * (n + 1)
for i in range(1, n + 1):
	F[i] = max(F[i - p], F[i - q])
	if F[i] != 0 and Prev[i] == 0:
		if F[i - max(p, q)] == 1:
			Prev[i] = i - max(p, q)
		else:
			Prev[i] = i - min(p, q)
if F[n] != 1:
	print(-1)
else:
	Ans = []
	i = n
	while i > 0:
		Ans.append(s[Prev[i]:i])
		i = Prev[i]
	print(len(Ans))
	for elem in Ans[::-1]:
		print(elem)


def calc_splits(n, q, p):
	max_q = int(n / q) + 1
	max_p = int(n / p) + 1
	for k in range(0, max_q):
		value = q * k
		if (n - value) % p == 0:
			return (k, q, int((n - value) / p), p)
	for i in range(0, max_p):
		value = p * i
		if (n - value) % q == 0:
			return (k, p, int((n - value) / q), q)
	return -1
_in = input()
(n, p, q) = _in.split(' ')
(n, p, q) = (int(n), int(p), int(q))
string = input()
value = calc_splits(n, p, q)
if value == -1:
	print(-1)
else:
	(k1, v1, k2, v2) = value
	print(k1 + k2)
	counter = 0
	for i in range(1, k1 + k2 + 1):
		if i <= k1:
			print(string[counter:counter + v1])
			counter += v1
		else:
			print(string[counter:counter + v2])
			counter += v2


(m, p, q) = map(int, input().split())
s = str(input())
lp = 0
lq = 0
for i in range(m + 1):
	for j in range(m + 1):
		if i * p + j * q == m:
			lp = i
			lq = j
			break
	if lp + lq > 0:
		break
if lp + lq == 0:
	print(-1)
else:
	print(lp + lq)
	aux = 0
	for i in range(lp):
		print(s[aux:aux + p])
		aux = aux + p
	for i in range(lq):
		print(s[aux:aux + q])
		aux = aux + q


try:
	import re

	def cg(string, length):
		return re.findall('.{%d}' % length, string)
	(n, p, q) = list(map(int, input().split(' ')))
	s = input()
	u = 0
	if len(s) % p == 0:
		u = 1
	elif len(s) % q == 0:
		u = 2
	else:
		u = 3
	if u == 1:
		print(n // p)
		k = cg(s, p)
		for i in k:
			print(i)
	elif u == 2:
		print(n // q)
		k = cg(s, q)
		for i in k:
			print(i)
	elif u == 3:
		flag = 0
		for i in range(1, n):
			for j in range(1, n):
				if p * i + q * j == n:
					op = [i, j]
					flag = 1
					break
		if flag == 1:
			print(sum(op))
			u = cg(s[0:p * op[0]], p)
			v = cg(s[p * op[0]:], q)
			ko = u + v
			for i in ko:
				print(i)
		else:
			print(-1)
except:
	pass


import random
import re
import string

def splitBy(strg, div, num):
	inter = list()
	pointer = 0
	for i in range(0, div):
		del inter[:]
		for it in range(pointer, num + pointer):
			inter.append(strg[it])
		pointer += num
		print(''.join(inter))

def verifyLinearC(n, p, q):
	n = n - p
	nump = 0
	numq = 0
	nump += 1
	while n > p:
		if n % q == 0:
			numq = n // q
			break
		else:
			n -= p
			nump += 1
	return (nump, numq)

def main():
	digit = input()
	digit = digit.split()
	lvet = list()
	for num in digit:
		lvet.append(int(num))
	inter = list()
	s = input()
	strg = []
	strg = s[:]
	divp = lvet[0] // lvet[1] if lvet[0] % lvet[1] == 0 else 0
	divq = lvet[0] // lvet[2] if lvet[0] % lvet[2] == 0 else 0
	if lvet[1] <= lvet[0] or lvet[2] <= lvet[0]:
		if divp != 0:
			print(divp)
			splitBy(strg, divp, lvet[1])
		elif divq != 0:
			print(divq)
			splitBy(strg, divq, lvet[2])
		elif lvet[1] + lvet[2] == lvet[0]:
			print(2)
			del inter[:]
			for i in range(0, lvet[1]):
				inter.append(strg[i])
			print(''.join(inter), sep='')
			del inter[:]
			for i in range(lvet[1], lvet[0]):
				inter.append(strg[i])
			print(''.join(inter), sep='')
		else:
			(nump, numq) = verifyLinearC(lvet[0], lvet[1], lvet[2])
			if numq * lvet[2] + nump * lvet[1] == lvet[0]:
				print(numq + nump)
				splitBy(strg, nump, lvet[1])
				strg = strg[nump * lvet[1]:]
				splitBy(strg, numq, lvet[2])
			else:
				(nump, numq) = verifyLinearC(lvet[0], lvet[2], lvet[1])
				if numq * lvet[1] + nump * lvet[2] == lvet[0]:
					print(numq + nump)
					splitBy(strg, numq, lvet[1])
					strg = strg[numq * lvet[1]:]
					splitBy(strg, nump, lvet[2])
				else:
					print('-1', sep='')
main()


INF = 10000
(n, p, q) = map(int, input().split())
s = input()
res = []
exit_flag = False
for i in range(INF):
	if exit_flag:
		break
	for j in range(INF):
		size = i * p + j * q
		if size == n:
			for auxi in range(i):
				res.append(s[:p])
				s = s[p:]
			for auxj in range(j):
				res.append(s[:q])
				s = s[q:]
			print(len(res))
			for word in res:
				print(word)
			exit(0)
		if i * p > n and j * p > n:
			exit_flag = True
			break
print(-1)


import sys
(n, p, q) = list(map(int, input().split()))
s = input()
for a in range(n + 1):
	for b in range(n + 1):
		if a * p + b * q == n:
			print(a + b)
			for i in range(a):
				print(s[i * p:i * p + p])
			s = s[p * a:]
			p = q
			a = b
			for i in range(a):
				print(s[i * p:i * p + p])
			sys.exit(0)
print('-1')


(n, p, q) = map(int, input().split())
s = input()
for i in range(101):
	for j in range(101):
		if p * i + q * j == n:
			print(i + j)
			for m in range(i):
				print(s[:p])
				s = s[p:]
			for t in range(j):
				print(s[:q])
				s = s[q:]
			quit()
print(-1)


def getSplits(n, p, q, s):
	least = min(p, q)
	greatest = max(p, q)
	if least > len(s):
		print(-1)
		return
	if len(s) % greatest == 0:
		index = greatest
	else:
		index = least
	prev = 0
	words = []
	while True:
		if index > len(s):
			print(-1)
			return
		words.append(s[prev:index])
		prev = index
		if index == len(s):
			break
		if (len(s) - index) % greatest == 0:
			index += greatest
			continue
		elif (len(s) - index) % least == 0:
			index += least
			continue
		else:
			index += least
	print(len(words))
	for word in words:
		print(word)
(n, p, q) = [int(x) for x in input().split()]
s = input()
getSplits(n, p, q, s)


import sys

def fun():
	try:
		(n, p, q) = map(int, input().split())
		s = input()
	except ValueError:
		print('输入出错')
		return
	(x, y) = map(int, Calpq(n, p, q, 0))
	if x < 0:
		print(-1)
	else:
		print(x + y)
		for i in range(x):
			print(s[p * i:p * (i + 1)])
		k = p * x
		for i in range(y):
			print(s[k + q * i:k + q * (i + 1)])
	pass

def Calpq(n, p, q, pn):
	k = n - p * pn
	if k < 0:
		return (-1, -1)
	elif k % q == 0:
		return (pn, k // q)
	else:
		return Calpq(n, p, q, pn + 1)
fun()


(n, p, q) = map(int, input().split())
s = input()
x = 0
ss = s
if n % p == 0:
	x = p
if n % q == 0:
	x = q
if x != 0:
	print(n // x)
	for i in range(0, n, x):
		print(s[i:i + x])
else:
	j = 0
	if p + q > n:
		print(-1)
		exit()
	while n > 0:
		j += 1
		n -= p
		if n % q == 0 and n > 0:
			x = p
			y = q
			res = j + n // q
			print(res)
			for i in range(0, j * p, x):
				print(s[i:i + x])
			for k in range(j * p, len(ss), q):
				print(s[k:k + q])
			exit()
	if x == 0:
		print(-1)


(n, p, q) = map(int, input().split(' '))
word = input()
answer = []
v = 0
if n % p == 0:
	v = 0
	while v + p <= n:
		answer.append(word[v:v + p])
		v += p
elif n % q == 0:
	v = 0
	while v + q <= n:
		answer.append(word[v:v + q])
		v += q
if v != n:
	vp = 0
	vq = 0
	aindaDa = True
	while aindaDa and vp * p + vq * q < n:
		vp += 1
		vq = 0
		j = 0
		while aindaDa:
			j += 1
			if j > n / q:
				vq = 0
				break
			vq += 1
			if vp * p + vq * q == n:
				v = n
				aindaDa = False
if v == n:
	if answer == []:
		v = 0
		for i in range(vp):
			answer.append(word[v:v + p])
			v += p
		for j in range(vq):
			answer.append(word[v:v + q])
			v += q
	print(len(answer))
	for w in answer:
		print(w)
else:
	print(-1)


(n, p, q) = map(int, input().split())
s = input()
for i in range(0, n // p + 1):
	if (n - i * p) % q == 0:
		print(i + (n - i * p) // q)
		for x in range(0, i):
			ss = s[:p]
			print(ss)
			s = s[p:]
		for x in range(0, (n - i * p) // q):
			ss = s[:q]
			print(ss)
			s = s[q:]
		exit()
print(-1)


(n, p, q) = [int(x) for x in input().split()]
s = input()
if p < q:
	(p, q) = (q, p)
for i in range(0, n // p + 1):
	if (n - p * i) % q == 0:
		print(i + (n - p * i) // q)
		k = 0
		for _ in range(i):
			print(s[k:k + p])
			k += p
		for _ in range((n - p * i) // q):
			print(s[k:k + q])
			k += q
		break
else:
	print(-1)


(n, x, y) = map(int, input().split())
s = input()
a = -1
b = -1
for i in range(n // y + 1):
	if (n - i * y) % x == 0:
		(a, b) = ((n - i * y) // x, i)
i = -1
if a == -1:
	print('-1')
	exit()
print(a + b)
for i in range(a):
	print(s[i * x:(i + 1) * x])
s = s[(i + 1) * x:]
for j in range(b):
	print(s[j * y:(j + 1) * y])


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
(n, a, b) = map(int, input().split())
s = input()
ansa = -1
ansb = -1
for i in range(0, 101):
	for j in range(0, 100):
		if a * i + b * j == n:
			ansa = i
			ansb = j
			break
if ansa == -1 and ansb == -1:
	print(-1)
	exit()
ans = [a] * ansa + [b] * ansb
prev = 0
print(len(ans))
for i in ans:
	print(s[prev:prev + i])
	prev += i


(n, p, q) = list(map(int, input().split()))
s = input()
res = (-1, -1)
for i in range(n + 1):
	if res[0] != -1:
		break
	for j in range(n + 1):
		ans = i * p + j * q
		if ans == n:
			res = (i, j)
			break
if res[0] == -1:
	print('-1')
	exit()
print(res[0] + res[1])
ind = 0
for i in range(res[0]):
	print(s[ind:ind + p])
	ind += p
for i in range(res[1]):
	print(s[ind:ind + q])
	ind += q


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

def new_list(n):
	return [0 for i in range(n)]
(n, p, q) = read_list()
s = input()
(l, r) = (-1, -1)
for i in range(n + 1):
	for j in range(n + 1):
		if i * p + j * q == n:
			l = i
			r = j
ns = []
if l == -1:
	print(-1)
	exit()
for i in range(0, l * p, p):
	ns.append(s[i:i + p])
for i in range(l * p, n, q):
	ns.append(s[i:i + q])
print(len(ns))
for n in ns:
	print(n)


(n, a, b) = map(int, input().split())
s = input()
visited = [False for i in range(1000)]
q = [[] for i in range(1000)]
visited[0] = True
for i in range(n):
	if visited[i]:
		if visited[i + a] == False:
			visited[i + a] = True
			q[i + a] = q[i] + [a]
		if visited[i + b] == False:
			visited[i + b] = True
			q[i + b] = q[i] + [b]
if sum(q[n]) == n:
	print(len(q[n]))
	pr = 0
	for x in q[n]:
		print(s[pr:x + pr])
		pr = x + pr
else:
	print(-1)


(n, p, q) = map(int, input().split(' ')[:3])
s = input()[:n]
a = 0
b = 0
while True:
	if a * p + b * q == n:
		break
	a += 1
	if a * p > n:
		a = 0
		b += 1
		if b * q > n:
			print(-1)
			exit(0)
print(a + b)
z = 0
for i in range(a):
	print(s[z:z + p])
	z += p
for i in range(b):
	print(s[z:z + q])
	z += q


(n, p, q) = [int(x) for x in input().split(' ')]
string = input()
s = list()
for i in range(n + 1):
	for j in range(n + 1):
		if n == i * p + j * q:
			print(i + j)
			index = 0
			for k in range(i):
				s.append(string[index:index + p])
				index += p
			for k in range(j):
				s.append(string[index:index + q])
				index += q
			for k in s:
				print(k)
			exit()
print(-1)


import sys
(n, p, q) = map(int, sys.stdin.readline().split())
word = list(input())
sol = -1
for i in range(0, int(n / p) + 1):
	for j in range(0, int(n / q) + 1):
		if i * p + j * q == n:
			sol = i + j
			print(sol)
			for k in range(0, n):
				sys.stdout.write(word[k])
				if i and k < i * p and (not (k + 1) % p) or (j and k >= i * p and (not (k - i * p + 1) % q)):
					print('')
			sys.exit(0)
		if sol != -1:
			break
if sol == -1:
	print('-1')


(n, p, q) = map(int, input().split())
s = input()
flag = False
a = -1
b = -1
for i in range(len(s) // p + 1):
	if flag:
		break
	for j in range(len(s) // q + 1):
		if i * p + j * q == n:
			flag = True
			a = i
			b = j
			break
if a == -1:
	print(-1)
else:
	print(a + b)
	for i in range(0, a):
		print(s[p * i:p * i + p])
	for j in range(0, b):
		if a != 0:
			print(s[q * j + (i + 1) * p:q * j + q + (i + 1) * p])
		else:
			print(s[q * j:q * j + q])


def verif(n, p, q):
	t = False
	a = 0
	b = 0
	for i in range(n):
		for j in range(n):
			if i * p + j * q == n:
				a = i
				b = j
				t = True
				break
	return (t, a, b)
(n, p, q) = map(int, input().split())
s = input()
(t, i, j) = verif(n, p, q)
if n == 1 and (p == 1 or q == 1):
	print('1')
	print(s[0])
elif t == False:
	print('-1')
else:
	print(i + j)
	for i in range(i):
		print(s[:p])
		s = s[p:]
	for i in range(j):
		print(s[:q])
		s = s[q:]


(N, P, Q) = map(int, input().split())
S = input()
flag = False
for i in range(101):
	for j in range(101):
		if i * P + j * Q == N:
			flag = True
			p = i
			q = j
if flag:
	print(p + q)
	while p:
		print(S[:P])
		S = S[P:]
		p -= 1
	while q:
		print(S[:Q])
		S = S[Q:]
		q -= 1
else:
	print(-1)


def main():
	(n, p, q) = map(int, input().split())
	if p < q:
		(p, q) = (q, p)
	for i in range(n % p, n + 1, p):
		if not i % q:
			break
	else:
		print('-1')
		return
	s = input()
	res = [s[j:j + p] for j in range(0, n - i, p)] + [s[j:j + q] for j in range(n - i, n, q)]
	print(len(res))
	print('\n'.join(res))
main()


import os

def main():
	(n, p, q) = map(int, input().split())
	(x, y) = (0, 0)
	for i in range(0, n + 1):
		if n >= i * p and (n - i * p) % q == 0:
			x = i
			y = (n - i * p) // q
			break
	s = input()
	cur = 0
	if x * p + q * y != n:
		print(-1)
		return
	print(x + y)
	for i in range(x):
		print(s[cur:cur + p])
		cur += p
	for i in range(y):
		print(s[cur:cur + q])
		cur += q
main()


inp = input().split(' ')
n = int(inp[0])
p = int(inp[1])
q = int(inp[2])
s = input()
x = y = 0
for i in range(1, n // p + 1):
	if (n - p * i) % q == 0:
		x = i
		y = (n - p * i) // q
if x == 0 and y == 0:
	for i in range(1, n // q + 1):
		if (n - q * i) % p == 0:
			y = i
			x = (n - q * i) // p
if x == 0 and y == 0:
	print(-1)
else:
	print(x + y)
	for i in range(x):
		print(s[i * p:i * p + p])
	for j in range(y):
		print(s[x * p + j * q:x * p + j * q + q])


(n, p, q) = [int(x) for x in input().split()]
s = input()
for i in range(0, n + 1):
	if n - i * p < 0:
		break
	if (n - i * p) % q == 0:
		ans = []
		for j in range(i):
			ans.append(s[j * p:j * p + p])
		for j in range((n - i * p) // q):
			ans.append(s[p * i + j * q:p * i + j * q + q])
		print(len(ans))
		for elem in ans:
			print(elem)
		exit()
print(-1)


(n, p, q) = map(int, input().split())
X = []
while n > 0:
	if n % p:
		n -= q
		X.append(q)
	else:
		X += [p] * (n // p)
		break
if n < 0:
	print(-1)
else:
	print(len(X))
	(s, i) = (input(), 0)
	for x in X:
		print(s[i:i + x])
		i += x