#include <bits/stdc++.h>
using namespace std;
const int Maxn = 500 + 100;
int d[Maxn][Maxn];
int par[Maxn][Maxn];
int palnum[Maxn][Maxn];
bool palmark[Maxn][Maxn];
bool mark[Maxn][Maxn];
string s, o;
int n, k;
int pal_num(int first, int end) {
  if (palmark[first][end]) return palnum[first][end];
  palmark[first][end] = true;
  int out = 0;
  for (int i = first; i <= (first + end - 1) / 2; i++)
    if (s[i] != s[end + first - i]) out++;
  palnum[first][end] = out;
  return out;
}
int calc(int place, int parts) {
  if (parts <= 0 && place != n) return Maxn * Maxn;
  if (place >= n) return 0;
  if (mark[place][parts]) return d[place][parts];
  mark[place][parts] = true;
  int out = Maxn * Maxn;
  int temp;
  if (parts > 1) {
    out = calc(place, parts - 1);
    par[place][parts] = par[place][parts - 1];
  }
  for (int i = place; i < n; i++) {
    temp = pal_num(place, i) + calc(i + 1, parts - 1);
    if (temp < out) {
      out = temp;
      par[place][parts] = i + 1;
    }
  }
  d[place][parts] = out;
  return out;
}
void output() {
  int remk = k;
  string temp;
  for (int i = 0; i < n;) {
    int j;
    temp = "";
    for (j = i; j < (par[i][remk] + i) / 2; j++) temp += s[j];
    o += temp;
    if ((par[i][remk] - i) % 2 == 1) o += s[(par[i][remk] + i) / 2];
    reverse(temp.begin(), temp.end());
    o += temp;
    i = par[i][remk];
    remk--;
    if (i != n) o += '+';
  }
  cout << d[0][k] << endl << o << endl;
}
void input() {
  cin >> s;
  n = s.length();
  cin >> k;
}
int main() {
  input();
  calc(0, k);
  output();
  return 0;
}
