#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long MAX = 1e7 + 1;
const long long MAXN = 1e5 + 3;
const long long eps = 1e-4;
string s;
int n, m;
int dp[503][503];
int p[503][503];
int DP(int x, int k) {
  if (x == n) {
    dp[x][k] = 0;
    return 0;
  }
  if (k >= m) {
    dp[x][k] = MAX;
    return MAX;
  }
  int &ret = dp[x][k];
  if (ret != -1) return ret;
  ret = MAX;
  for (int i = x; i < n; i++) {
    ret = min(ret, p[x][i] + DP(i + 1, k + 1));
  }
  return ret;
}
int build(int x, int y) {
  if (x + 1 == y) {
    if (s[x] == s[y]) {
      p[x][y] = 0;
      return 0;
    } else {
      p[x][y] = 1;
      return 1;
    }
  }
  if (x == y) {
    p[x][y] = 0;
    return 0;
  }
  int &ret = p[x][y];
  if (ret != -1) return ret;
  ret = build(x + 1, y - 1) + (s[x] != s[y]);
  return ret;
}
void print(int x, int y) {
  for (int i = x; i <= y; i++) {
    int pos = y - (i - x);
    s[i] = s[pos];
    cout << s[i];
  }
}
void fs(int x, int k) {
  if (x == n) exit(0);
  int ret = dp[x][k];
  for (int i = x; i < n; i++) {
    if (ret == p[x][i] + dp[i + 1][k + 1]) {
      print(x, i);
      if (i + 1 != n) cout << '+';
      fs(i + 1, k + 1);
      exit(0);
    }
  }
}
int main() {
  memset(p, -1, sizeof(p));
  memset(dp, -1, sizeof(dp));
  cin >> s >> m;
  n = s.size();
  for (int i = 0; i < n; i++) build(0, i), build(i, n - 1);
  cout << DP(0, 0) << endl;
  fs(0, 0);
  return 0;
}
