B. Obtaining the String

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

You are given two strings ss and tt. Both strings have length nn and consist of lowercase Latin letters. The characters in the strings are numbered from 11 to nn.

You can successively perform the following move any number of times (possibly, zero):

• swap any two adjacent (neighboring) characters of ss (i.e. for any i={1,2,…,n−1}i={1,2,…,n−1} you can swap sisi and si+1)si+1).

You can't apply a move to the string tt. The moves are applied to the string ss one after another.

Your task is to obtain the string tt from the string ss. Find any way to do it with at most 104104 such moves.

You do not have to minimize the number of moves, just find any sequence of moves of length 104104 or less to transform ss into tt.

Input

The first line of the input contains one integer nn (1≤n≤501≤n≤50) — the length of strings ss and tt.

The second line of the input contains the string ss consisting of nn lowercase Latin letters.

The third line of the input contains the string tt consisting of nn lowercase Latin letters.

Output

If it is impossible to obtain the string tt using moves, print "-1".

Otherwise in the first line print one integer kk — the number of moves to transform ss to tt. Note that kk must be an integer number between 00 and 104104 inclusive.

In the second line print kk integers cjcj (1≤cj<n1≤cj<n), where cjcj means that on the jj-th move you swap characters scjscj and scj+1scj+1.

If you do not need to apply any moves, print a single integer 00 in the first line and either leave the second line empty or do not print it at all.

Examples

input

Copy

6
abcdef
abdfec

output

Copy

4
3 5 4 5

input

Copy

4
abcd
accd

output

Copy

-1

Note

In the first example the string ss changes as follows: "abcdef" →→ "abdcef" →→ "abdcfe" →→ "abdfce" →→ "abdfec".

In the second example there is no way to transform the string ss into the string tt through any allowed moves.

a中的字母其实每一个字母有一个对应位置，例如pxlsdz1314，那p是0，x是1…….,如果b的字符串中字母和a中相同，b相当于a的另一种排列，那即每一个字母的位置发生改变，假如b为sdzpxl1314，则它的顺序3450126789，所以我们对数字位置排序就欧克了，但根据交换规则，冒泡排序正好满足条件，题目解决。

`#include<cstdio>  #include<cstring>  #include<cstdlib>  #include<cctype>  #include<cmath>  #include<iostream>  #include<sstream>  #include<iterator>  #include<algorithm>  #include<string>  #include<vector>  #include<set>  #include<map>  #include<stack>  #include<deque>  #include<queue>  #include<list>  using namespace std;  const double eps = 1e-8;  typedef long long LL;  typedef unsigned long long ULL;  const int INF = 0x3f3f3f3f;  const int INT_M_INF = 0x7f7f7f7f;  const LL LL_INF = 0x3f3f3f3f3f3f3f3f;  const LL LL_M_INF = 0x7f7f7f7f7f7f7f7f;  const int dr[] = {0, 0, -1, 1, -1, -1, 1, 1};  const int dc[] = {-1, 1, 0, 0, -1, 1, -1, 1};  const int MOD = 1e9 + 7;  const double pi = acos(-1.0);  const int MAXN=5010;  const int MAXM=100010;using namespace std;char st,et;int cnt1,cnt2;int stn,etn,n;int main(){    queue<int>ans;    while(!ans.empty()) ans.pop();    cin>>n>>st>>et;      int flag=1;    for(int i=0;i<n;i++)    {                if(flag&&st[i]!=et[i]) flag=0;        cnt1[st[i]-'a']++;        cnt2[et[i]-'a']++;    }    if(flag)      //全部相等    {        cout<<0<<endl;        return 0;    }    for(int i=0;i<=25;i++)    {        if(cnt1[i]!=cnt2[i])        {            cout<<-1<<endl;            return 0;        }    }    for(int i=0;i<n;i++)     //将第二个进行个赋值    {        for(int j=0;j<n;j++)        {            if(et[i]==st[j]&&!stn[j])  //有一个细节处理，stn[j]不能重复出现            {                stn[j]=i;                break;            }        }    }    for(int i=0;i<n-1;i++)      //冒泡排序        for(int j=0;j<n-i-1;j++)        {            if(stn[j]>stn[j+1])            {                swap(stn[j],stn[j+1]);                ans.push(j);            }         }    cout<<ans.size()<<endl;    while(!ans.empty())    {        cout<<ans.front()+1<<" ";        ans.pop();    }    return 0;}`