Problem: Friday is Polycarpus' favourite day of the week. Not because it is followed by the weekend, but because the lessons on Friday are 2 IT lessons, 2 math lessons and 2 literature lessons. Of course, Polycarpus has prepared to all of them, unlike his buddy Innocentius. Innocentius spent all evening playing his favourite game Fur2 and didn't have enough time to do the literature task. As Innocentius didn't want to get an F, he decided to do the task and read the book called "Storm and Calm" during the IT and Math lessons (he never used to have problems with these subjects). When the IT teacher Mr. Watkins saw this, he decided to give Innocentius another task so that the boy concentrated more on the lesson and less — on the staff that has nothing to do with IT. 

Mr. Watkins said that a palindrome is a string that can be read the same way in either direction, from the left to the right and from the right to the left. A concatenation of strings a, b is a string ab that results from consecutive adding of string b to string a. Of course, Innocentius knew it all but the task was much harder than he could have imagined. Mr. Watkins asked change in the "Storm and Calm" the minimum number of characters so that the text of the book would also be a concatenation of no more than k palindromes. Innocentius can't complete the task and therefore asks you to help him.

Input

The first input line contains a non-empty string s which is the text of "Storm and Calm" (without spaces). The length of the string s does not exceed 500 characters. String s consists of uppercase and lowercase Latin letters. The second line contains a single number k (1 ≤ k ≤ |s|, where |s| represents the length of the string s).

Output

Print on the first line the minimum number of changes that Innocentius will have to make. Print on the second line the string consisting of no more than k palindromes. Each palindrome should be non-empty and consist of uppercase and lowercase Latin letters. Use the character "+" (ASCII-code 43) to separate consecutive palindromes. If there exist several solutions, print any of them.

The letters' case does matter, that is an uppercase letter is not considered equivalent to the corresponding lowercase letter.

Examples

Input

abacaba
1


Output

0
abacaba


Input

abdcaba
2


Output

1
abdcdba


Input

abdcaba
5


Output

0
a+b+d+c+aba


Input

abacababababbcbabcd
3


Output

1
abacaba+babab+bcbabcb

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;
import java.math.BigInteger;

public class Main{
    final boolean isFileIO =  false;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer st = new StringTokenizer("");
    String delim = " ";

    public static void main(String[] args) throws IOException {
        Main m = new Main();
        m.initIO();
        m.solve();
        m.in.close();
        m.out.close();
    }

    public void initIO() throws IOException {
        if(!isFileIO) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("laser_maze.txt"));
            out = new PrintWriter("output.txt"); 
        }
    }
  
    String nextToken() throws IOException {
        if(!st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken(delim);
    }

    String readLine() throws IOException {
        return in.readLine();
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    public void solve() throws IOException {
        String s = readLine();
        int n = s.length();
        int k = nextInt();
        int[][] min = new int[k + 1][n + 1];
        int[][] pos = new int[k + 1][n + 1];
        int[][] cnt = new int[n + 1][n + 1];
        for(int i = 1; i <= n; i++) {
            for(int j = i; j <= n; j++) {
                cnt[i][j] = transform(s, i - 1, j - 1);
            }
        }
        for(int i = 0; i <= k; i++) {
            for(int j = 0; j <= n; j++) {
                min[i][j] = Integer.MAX_VALUE;
            }
        }
        min[0][0] = 0;
        for(int i = 1; i <= k; i++) {
            for(int j = 1; j <= n; j++) {                
                for(int z = j - 1; z >= 0; z--) {
                    if(min[i - 1][z] == Integer.MAX_VALUE) {
                        continue;
                    }
                    if(min[i][j] > min[i - 1][z] + cnt[z + 1][j]) {
                        min[i][j] = min[i - 1][z] + cnt[z + 1][j];
                        pos[i][j] = z;
                    }
                }
            }
        }
        int ans = Integer.MAX_VALUE;
        int index = 0;
        for(int i = 1; i <= k; i++) {
            if(min[i][n] < ans) {
                ans = min[i][n];
                index = i;
            }
        }
        ArrayList<Integer> t = new ArrayList<Integer>();
        int cur = n;
        t.add(n);
        while(cur != 0) {            
            cur = pos[index][cur];
            t.add(cur);
            index--;
        }
        ArrayList<String> rows = new ArrayList<String>();
        for(int i = 0; i < t.size() - 1; i++) {
            int to = t.get(i) - 1;
            int from = t.get(i + 1);
            char[] str = new char[to - from + 1];
            for(int j = from, z = 0; j <= to; j++, z++) {
                str[z] = s.charAt(j);
            }
            int mid = (to - from + 1) / 2;
            int len = (to - from + 1);
            for(int j = 0; j < mid; j++) {
                if(str[j] != str[len - j - 1]) {
                    str[j] = str[len - j - 1];
                }
            }
            rows.add(new String(str));
        }
        out.println(ans);
        for(int i = rows.size() - 1; i > 0; i--) {
            out.print(rows.get(i) + "+");
        }
        out.print(rows.get(0));        
    }

    int transform(String s, int from, int to) {
        int mid = (to - from + 1) / 2;
        int res = 0;
        for(int i = from, j = 0; i < from + mid; i++, j++) {
            if(s.charAt(i) != s.charAt(to - j)) {
                res++;
            }
        }
        return res;
    }

}

class Utils {

    public static long binpow(long a, long exp, long mod) {
        if(exp == 0) {
            return 1;
        }
        if(exp % 2 == 0) {
            long temp = binpow(a, exp / 2, mod);
            return (temp * temp) % mod;
        } else {
            return (binpow(a, exp - 1, mod) * a) % mod;
        }
    }

    public static long inv(long a, long mod) {
        return binpow(a, mod - 2, mod);
    }

    public static long addmod(long a, long b, long mod) {
        return ((a + b) % mod + mod) % mod;
    }

    public static long gcd(long a, long b) {
        if(b == 0)
            return a;
        return gcd(b, a % b);
    }

    //mul must be < 10^18
    public static long mulmod(long a, long b, long mod) {
        return (a * b + (((a * b) / mod) + 1) * mod) % mod;
    }
}