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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &A) {
  for (long long i = 0; i < A.size(); i++) os << A[i] << " ";
  os << endl;
  return os;
}
template <>
ostream &operator<<(ostream &os, const vector<vector<long long> > &A) {
  long long N = A.size();
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < A[i].size(); j++) os << A[i][j] << " ";
    os << endl;
  }
  return os;
}
struct edge {
  long long from, to, d, c;
  edge(long long _from = 0, long long _to = 0, long long _d = 0,
       long long _c = 0) {
    from = _from;
    to = _to;
    d = _d;
    c = _c;
  }
  bool operator<(const edge &rhs) const {
    return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
  }
};
struct aabb {
  long long x1, y1, x2, y2;
  aabb(long long x1, long long y1, long long x2, long long y2)
      : x1(x1), y1(y1), x2(x2), y2(y2) {}
};
struct flow {
  long long to, cap, rev, cost;
  flow(long long to = 0, long long cap = 0, long long rev = 0,
       long long cost = 0)
      : to(to), cap(cap), rev(rev), cost(cost) {}
};
const long long di[4] = {0, -1, 0, 1};
const long long dj[4] = {-1, 0, 1, 0};
const long long ci[5] = {0, 0, -1, 0, 1};
const long long cj[5] = {0, -1, 0, 1, 0};
const long long LINF = LLONG_MAX / 2;
const long long INF = INT_MAX / 2;
const long double PI = acos(-1);
long long pow2(long long n) { return 1LL << n; }
template <typename T, typename U>
bool chmin(T &x, const U &y) {
  if (x > y) {
    x = y;
    return true;
  }
  return false;
}
template <typename T, typename U>
bool chmax(T &x, const U &y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  fill((T *)array, (T *)(array + N), val);
}
struct initializer {
  initializer() { cout << fixed << setprecision(20); }
};
initializer _____;
long long N, M, K, T, Q, H, W;
signed main() {
  string S;
  cin >> S;
  N = S.size();
  cin >> K;
  vector<vector<long long> > cost(N, vector<long long>(N, 0));
  for (long long i = 0; i < (long long)(N); i++)
    for (long long j = 0; j < (long long)(N); j++)
      if (i <= j) {
        long long size = j - i + 1;
        for (long long k = 0; k < (long long)(size / 2); k++) {
          if (S[i + k] != S[j - k]) cost[i][j]++;
        }
      }
  vector<vector<long long> > dp(N + 1, vector<long long>(K + 1, LINF));
  dp[0][0] = 0;
  for (long long i = 0; i < (long long)(N); i++)
    for (long long k = 0; k < (long long)(K); k++) {
      for (long long j = 0; j < (long long)(i + 1); j++) {
        chmin(dp[i + 1][k + 1], dp[j][k] + cost[j][i]);
      }
    }
  long long k;
  long long ans = LINF;
  for (long long i = 0; i < (long long)(K); i++) {
    if (chmin(ans, dp[N][i + 1])) {
      k = i + 1;
    }
  }
  cout << ans << endl;
  vector<string> ans2;
  long long i = N - 1;
  while (i >= 0) {
    for (long long j = 0; j < (long long)(i + 1); j++) {
      if (dp[i + 1][k] == dp[j][k - 1] + cost[j][i]) {
        string T = S.substr(j, i - j + 1);
        for (long long l = 0; l < (long long)(T.size() / 2); l++) {
          if (T[l] != T[T.size() - 1 - l]) T[l] = T[T.size() - 1 - l];
        }
        ans2.push_back(T);
        k--;
        i = j - 1;
        break;
      }
    }
  }
  reverse(ans2.begin(), ans2.end());
  for (long long i = 0; i < (long long)(ans2.size() - 1); i++)
    cout << ans2[i] << "+";
  cout << ans2[ans2.size() - 1] << endl;
  return 0;
}