#include <bits/stdc++.h>
using namespace std;
const int N = 500 + 10, inf = 1e9;
int n, k, dp[N][N], cost[N][N], par[N][N];
vector<string> v;
string s;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> s >> k;
  n = s.size();
  for (int i = 1; i < N; i++)
    for (int j = 0; j < N; j++) dp[i][j] = inf;
  dp[0][0] = inf;
  for (int l = 1; l < n; l++)
    for (int i = 0; i + l < n; i++)
      cost[i][i + l] = cost[i + 1][i + l - 1] + (s[i] != s[i + l]);
  for (int i = 0; i < n; i++) {
    dp[i][1] = cost[0][i];
    par[i][1] = -1;
  }
  for (int i = 1; i < n; i++)
    for (int j = 2; j <= k; j++) {
      dp[i][j] = dp[i][j - 1];
      par[i][j] = par[i][j - 1];
      for (int l = i; l >= 1; l--) {
        if (dp[l - 1][j - 1] + cost[l][i] < dp[i][j]) {
          dp[i][j] = dp[l - 1][j - 1] + cost[l][i];
          par[i][j] = l - 1;
        }
      }
    }
  cout << dp[n - 1][k] << endl;
  int p = n - 1;
  while (p != -1) {
    string t;
    for (int i = p, h = par[p][k] + 1; i > par[p][k]; i--, h++)
      t += s[max(i, h)];
    if (!t.empty()) v.push_back(t);
    p = par[p][k];
    k--;
  }
  reverse(v.begin(), v.end());
  cout << v[0];
  for (int i = 1; i < v.size(); i++) cout << '+' << v[i];
}
