#include <bits/stdc++.h>
using namespace std;
const int Maxn = 503;
string s, out[Maxn];
int k, DP, n, dp[Maxn][Maxn], cost[Maxn][Maxn], par[Maxn][Maxn];
vector<int> vec;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> s >> k;
  n = s.size();
  for (int i = 2; i <= n; i++)
    for (int j = 0; j <= n - i; j++) {
      cost[j][j + i] = cost[j + 1][j + i - 1];
      if (s[j + i - 1] != s[j]) cost[j][j + i]++;
    }
  for (int i = 1; i <= n; i++) dp[i][1] = cost[0][i];
  for (int i = 1; i <= n; i++) {
    for (int j = 2; j <= k; j++) {
      DP = dp[i][j - 1], par[i][j] = i;
      for (int f = 0; f < i; f++)
        if (DP > cost[f][i] + dp[f][j - 1])
          DP = cost[f][i] + dp[f][j - 1], par[i][j] = f;
      dp[i][j] = DP;
    }
  }
  cout << dp[n][k] << endl;
  int N = n, K = k;
  while (K > 0) {
    if (N != par[N][K]) vec.push_back(N);
    N = par[N][K];
    K--;
  }
  reverse(vec.begin(), vec.end());
  for (int i = 0, f = 0; i < n; i++) {
    if (vec[f] == i) f++;
    out[f] += s[i];
  }
  for (int i = 0; i < (int)vec.size(); i++) {
    int m = out[i].size();
    for (int j = 0; j < m / 2; j++) out[i][j] = out[i][m - j - 1];
    cout << out[i] << (i != (int)vec.size() - 1 ? "+" : "");
  }
}
