Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official.
×

Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

C. Anagram

time limit per test

1 secondmemory limit per test

256 megabytesinput

input.txtoutput

output.txtString *x* is an anagram of string *y*, if we can rearrange the letters in string *x* and get exact string *y*. For example, strings "DOG" and "GOD" are anagrams, so are strings "BABA" and "AABB", but strings "ABBAC" and "CAABA" are not.

You are given two strings *s* and *t* of the same length, consisting of uppercase English letters. You need to get the anagram of string *t* from string *s*. You are permitted to perform the replacing operation: every operation is replacing some character from the string *s* by any other character. Get the anagram of string *t* in the least number of replacing operations. If you can get multiple anagrams of string *t* in the least number of operations, get the lexicographically minimal one.

The lexicographic order of strings is the familiar to us "dictionary" order. Formally, the string *p* of length *n* is lexicographically smaller than string *q* of the same length, if *p*_{1} = *q*_{1}, *p*_{2} = *q*_{2}, ..., *p*_{k - 1} = *q*_{k - 1}, *p*_{k} < *q*_{k} for some *k* (1 ≤ *k* ≤ *n*). Here characters in the strings are numbered from 1. The characters of the strings are compared in the alphabetic order.

Input

The input consists of two lines. The first line contains string *s*, the second line contains string *t*. The strings have the same length (from 1 to 10^{5} characters) and consist of uppercase English letters.

Output

In the first line print *z* — the minimum number of replacement operations, needed to get an anagram of string *t* from string *s*. In the second line print the lexicographically minimum anagram that could be obtained in *z* operations.

Examples

Input

ABA

CBA

Output

1

ABC

Input

CDBABC

ADCABD

Output

2

ADBADC

Note

The second sample has eight anagrams of string *t*, that can be obtained from string *s* by replacing exactly two letters: "ADBADC", "ADDABC", "CDAABD", "CDBAAD", "CDBADA", "CDDABA", "DDAABC", "DDBAAC". These anagrams are listed in the lexicographical order. The lexicographically minimum anagram is "ADBADC".

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/12/2018 00:29:51 (f2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|