#include <bits/stdc++.h>
using namespace std;
const int N = 500;
char cc[N + 1];
int pp[N][N], dp[N][N];
void print(int l, int r) {
  if (l > r) return;
  cout << cc[l];
  if (l < r) {
    print(l + 1, r - 1);
    cout << cc[l];
  }
}
void solve(int h, int j) {
  while (h && dp[h - 1][j] == dp[h][j]) h--;
  if (h == 0) {
    print(0, j);
    return;
  }
  for (int i = 0; i < j; i++)
    if (dp[h - 1][i] + pp[i + 1][j] == dp[h][j]) {
      solve(h - 1, i);
      cout << '+';
      print(i + 1, j);
      return;
    }
}
int main() {
  int k;
  cin >> cc >> k;
  int n = strlen(cc);
  for (int i = n - 1; i >= 0; i--)
    for (int j = i + 1; j < n; j++)
      pp[i][j] = pp[i + 1][j - 1] + (cc[i] != cc[j]);
  for (int i = 0; i < n; i++) dp[0][i] = pp[0][i];
  for (int h = 1; h < k; h++) {
    for (int j = 0; j < n; j++) {
      int x = dp[h - 1][j];
      for (int i = 0; i < j; i++) x = min(x, dp[h - 1][i] + pp[i + 1][j]);
      dp[h][j] = x;
    }
  }
  cout << dp[k - 1][n - 1] << '\n';
  solve(k - 1, n - 1);
  cout << '\n';
  return 0;
}
