#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const bool debug = true;
const long long INFL = LLONG_MAX;
string s;
int N, K, memo[510][510], from[510][510], change[510][510];
bool was[510][510];
void correct(int f, int len) {
  for (int i = 0; i < (len >> 1); i++) {
    s[i + f] = s[len + f - 1 - i];
  }
}
void print(int len, int k) {
  if (from[len][k] == 1) {
    correct(1, len);
    cout << s.substr(1, len);
  } else {
    print(from[len][k] - 1, k - 1);
    correct(from[len][k], len - from[len][k] + 1);
    cout << "+" << s.substr(from[len][k], len - from[len][k] + 1);
  }
}
int dp(int len, int k) {
  if (len == 0 && k == 0) return 0;
  if (len <= 0 || k <= 0 || len < k) return -1;
  int& x = memo[len][k];
  if (!was[len][k]) {
    x = INF;
    for (int(l) = 1; (l) <= (len); (l)++) {
      int res = dp(len - l, k - 1);
      if (res == -1) continue;
      res += change[len - l + 1][len];
      if (res < x) {
        x = res;
        from[len][k] = len - l + 1;
      }
    }
  }
  was[len][k] = 1;
  return x;
}
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(15);
  cout << fixed;
  cin >> s >> K;
  N = s.size();
  s = " " + s;
  for (int(i) = 1; (i) <= (N); (i)++)
    for (int(j) = 1; (j) <= (N); (j)++)
      if (i <= j) {
        int ii = i;
        int jj = j;
        while (ii <= jj) {
          if (s[ii] != s[jj]) change[i][j]++;
          ii++;
          jj--;
        }
      }
  int mn = INF;
  for (int(i) = 1; (i) <= (K); (i)++) mn = min(mn, dp(N, i));
  cout << mn << '\n';
  for (int(i) = 1; (i) <= (K); (i)++) {
    if (dp(N, i) == mn) {
      print(N, i);
      cout << '\n';
      return 0;
    }
  }
}
