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.util.*;
import java.io.*;
        public class uu {
        	static Integer [][]memo;
        	static Integer [][]palindrome;
        	static char [] arr;
        	static int n ,k;
        	public static void main(String[] args) throws IOException, InterruptedException {
        		Scanner sc =new Scanner(System.in);
        		PrintWriter pw =new PrintWriter(System.out);
        		arr=sc.nextLine().toCharArray();
        		n=arr.length;
        		k=sc.nextInt();
        		memo=new Integer [n+6][k+6];
        		palindrome=new Integer [n+6][n+6];
        		pw.println(dp(0, 0));pw.flush();
        		trace(0, 0);       		
        		}
        	static int dp (int i ,int j) {
        		if (j>k)
        			return (int)1e9;
        		if (i>=n)
        			return 0;
        		if (memo[i][j]!=null)
        			return memo[i][j];
        		int min=(int)1e9;
        		for (int index=i;index<n;++index)
        			min=Math.min(dp(index+1, j+1)+solve(i, index), min);
        		return memo[i][j]=min;
        	}
        	static int solve (int s ,int e) {
        		if (s>=e)
        			return 0;
        		if (palindrome[s][e]!=null)
        			return palindrome[s][e];
        		return palindrome[s][e]=((arr[s]==arr[e])?0:1)+solve(s+1, e-1);
        	}
        	static void trace(int i ,int j) {
        		if (i==n)
        			return;
        		for (int index =i;index<n;++index) {
        			if (dp(i, j)==dp(index+1, j+1)+solve(i, index)) {
        				int l =index;
        				for (int y=i;y<=index;++y) {
        					System.out.print(arr[y]);
        					arr[l--]=arr[y];
        				}
        				if (index!=n-1)
        					System.out.print("+");
        					trace(index+1, j+1);
        					return;
        			}
        		}
        	}
              static int mod(int x,int y)
            {
                if(x<0)
                    x=x+(-x/y+1)*y;
                return x%y;
            }
    		static long gcd(long a, long b) 
    		{ 
    		    if (a == 0) 
    		        return b; 
    		    return gcd(b % a, a); 
    		}
			static class Scanner {
				StringTokenizer stringTokenizer;
				BufferedReader bfBufferedReader;
				public Scanner(InputStream system) {
					bfBufferedReader=new BufferedReader(new InputStreamReader( system));
				}
				 public Scanner(String file) throws Exception {
			            bfBufferedReader = new BufferedReader(new FileReader( file));
			        }			 
			        public String next() throws IOException {
			            while (stringTokenizer == null || !stringTokenizer.hasMoreTokens())
			                stringTokenizer = new StringTokenizer( bfBufferedReader.readLine());
			            return stringTokenizer.nextToken();
			        }
			 
			        public String nextLine() throws IOException {
			            return bfBufferedReader.readLine();
			        }
			 
			        public int nextInt() throws IOException {
			            return Integer.parseInt(next());
			        }
			 
			        public double nextDouble() throws IOException {
			            return Double.parseDouble(next());
			        }
			 
			        public char nextChar() throws IOException {
			            return next().charAt(0);
			        }
			 
			        public Long nextLong() throws IOException {
			            return Long.parseLong(next());
			        }
			 
			        public boolean ready() throws IOException {
			            return bfBufferedReader.ready();
			        }
			 
			        public void waitForInput() throws InterruptedException {
			            Thread.sleep(3000);
			        }
			    }
			public static class InfixEvaluation {

			    public int evaluate(String expression){
			        //Stack for Numbers
			        Stack<Integer> numbers = new Stack<>();

			        //Stack for operators
			        Stack<Character> operations = new Stack<>();
			        for(int i=0; i<expression.length();i++) {
			            char c = expression.charAt(i);
			            //check if it is number
			            if(Character.isDigit(c)){
			                //Entry is Digit, it could be greater than one digit number
			                int num = 0;
			                while (Character.isDigit(c)) {
			                    num = num*10 + (c-'0');
			                    i++;
			                    if(i < expression.length())
			                        c = expression.charAt(i);
			                    else
			                        break;
			                }
			                i--;
			                //push it into stack
			                numbers.push(num);
			            }else if(c=='('){
			                //push it to operators stack
			                operations.push(c);
			            }
			            //Closed brace, evaluate the entire brace
			            else if(c==')') {
			                while(operations.peek()!='('){
			                    int output = performOperation(numbers, operations);
			                    //push it back to stack
			                    numbers.push(output);
			                }
			                operations.pop();
			            }
			            // current character is operator
			            else if(isOperator(c)){
			                //1. If current operator has higher precedence than operator on top of the stack,
			                //the current operator can be placed in stack
			                // 2. else keep popping operator from stack and perform the operation in  numbers stack till
			                //either stack is not empty or current operator has higher precedence than operator on top of the stack
			                while(!operations.isEmpty() && precedence(c)<precedence(operations.peek())){
			                    int output = performOperation(numbers, operations);
			                    //push it back to stack
			                    numbers.push(output);
			                }
			                //now push the current operator to stack
			                operations.push(c);
			            }
			        }
			        //If here means entire expression has been processed,
			        //Perform the remaining operations in stack to the numbers stack

			        while(!operations.isEmpty()){
			            int output = performOperation(numbers, operations);
			            //push it back to stack
			            numbers.push(output);
			        }
			        return numbers.pop();
			    }

			    static int precedence(char c){
			        switch (c){
			            case '+':
			            case '-':
			                return 1;
			            case '*':
			            case '/':
			                return 2;
			            case '^':
			                return 3;
			        }
			        return -1;
			    }

			    public int performOperation(Stack<Integer> numbers, Stack<Character> operations) {
			        int a = numbers.pop();
			        int b = numbers.pop();
			        char operation = operations.pop();
			        switch (operation) {
			            case '+':
			                return a + b;
			            case '-':
			                return b - a;
			            case '*':
			                return a * b;
			            case '/':
			                if (a == 0)
			                    throw new
			                            UnsupportedOperationException("Cannot divide by zero");
			                return b / a;
			        }
			        return 0;
			    }

			    public boolean isOperator(char c){
			        return (c=='+'||c=='-'||c=='/'||c=='*'||c=='^');
			    }
			}
        }