#include <bits/stdc++.h>
using namespace std;
const int nMax = 504;
int changes[nMax][nMax], parent[nMax][nMax];
string changed[nMax][nMax];
int dp[nMax][nMax];
string s;
int main() {
  cin >> s;
  int n = (int)s.size(), k;
  cin >> k;
  for (int j = 0; j < n; ++j) {
    for (int i = j; i >= 0; --i) {
      changes[i][j] = (s[i] != s[j]);
      if (j - i > 1) changes[i][j] += changes[i + 1][j - 1];
      if (i == j) {
        changed[i][j] = s[i];
      } else {
        if (j - i == 1) {
          changed[i][j] += s[i];
          changed[i][j] += s[i];
        } else {
          changed[i][j] = s[i] + changed[i + 1][j - 1] + s[i];
        }
      }
    }
  }
  for (int i = 0; i < k; ++i) {
    for (int j = n - 1; j >= 0; --j) {
      if (i == 0) {
        dp[i][j] = changes[j][n - 1];
        parent[i][j] = n - 1;
      } else {
        dp[i][j] = INT_MAX;
        for (int t = j; t < n - 1; ++t) {
          if (changes[j][t] + dp[i - 1][t + 1] < dp[i][j]) {
            dp[i][j] = changes[j][t] + dp[i - 1][t + 1];
            parent[i][j] = t;
          }
        }
        if (dp[i][j] == INT_MAX) dp[i][j] = 0;
      }
    }
  }
  int ans = INT_MAX, pos = 0;
  for (int i = 0; i < k; ++i) {
    if (dp[i][0] < ans) {
      pos = i;
      ans = dp[i][0];
    }
  }
  cout << ans << endl;
  int from = 0, to = 0;
  while (pos >= 0 && from < n) {
    to = parent[pos][from];
    cout << changed[from][to];
    if (pos) cout << "+";
    --pos;
    from = to + 1;
  }
  return 0;
}
