Reversing Encryption

题意翻译

一个长度为 $n$ 的字符串 $a$ 可以被以下算法加密: - 以降序遍历 $n$ 的所有除数(即从 $n$ 至 $1$) - 对于每一个除数 $d$ , 反转子字符串 $s[1\dots d]$ (即从 $1$ 开始到 $d$ 结尾的字符串) 例如,将该算法应用到字符串 `s = "codeforces"​` 将造成以下变化: ​ `"codeforces"` $\to$ `"secrofedoc"` $\to$ `"orcesfedoc"` $\to$ `"rocesfedoc"` $\to$ `"rocesfedoc"` (显然,因为 $d = 1$ 所以最后一次反转操作没有对字符串造成变化) 你的程序将被给予一个加密过的字符串 $t$ 。你的任务是解密它,即找到一个字符串 $s$ 被以上算法加密后结果为 $t$ 。数据保证字符串 $s$ 存在且是唯一的。 #### 输入 第一行包括一个整数 $n (1 ≤ n ≤ 100)$ 为字符串 $t$ 的长度。 第二行为字符串 $t$ ,只包含小写英文字母。 #### 输出 输出字符串 $s$ 。 #### 说明 题目描述中介绍了第一个样例。

题目描述

A string $ s $ of length $ n $ can be encrypted by the following algorithm: - iterate over all divisors of $ n $ in decreasing order (i.e. from $ n $ to $ 1 $ ), - for each divisor $ d $ , reverse the substring $ s[1 \dots d] $ (i.e. the substring which starts at position $ 1 $ and ends at position $ d $ ). For example, the above algorithm applied to the string $ s $ ="codeforces" leads to the following changes: "codeforces" $ \to $ "secrofedoc" $ \to $ "orcesfedoc" $ \to $ "rocesfedoc" $ \to $ "rocesfedoc" (obviously, the last reverse operation doesn't change the string because $ d=1 $ ). You are given the encrypted string $ t $ . Your task is to decrypt this string, i.e., to find a string $ s $ such that the above algorithm results in string $ t $ . It can be proven that this string $ s $ always exists and is unique.

输入输出格式

输入格式


The first line of input consists of a single integer $ n $ ( $ 1 \le n \le 100 $ ) — the length of the string $ t $ . The second line of input consists of the string $ t $ . The length of $ t $ is $ n $ , and it consists only of lowercase Latin letters.

输出格式


Print a string $ s $ such that the above algorithm results in $ t $ .

输入输出样例

输入样例 #1

10
rocesfedoc

输出样例 #1

codeforces

输入样例 #2

16
plmaetwoxesisiht

输出样例 #2

thisisexampletwo

输入样例 #3

1
z

输出样例 #3

z

说明

The first example is described in the problem statement.