#include <bits/stdc++.h>
volatile bool isLocalTestEnabled = 0;
bool g_isLocalPrintEnabled = (bool)(0);
template <typename T>
void UpdateMin(T& a, const T b) {
  a = std::min(a, b);
}
template <typename T>
void UpdateMax(T& a, const T b) {
  a = std::max(a, b);
}
const long double Pi = std::atan(1.0L) * 4.0L;
static const long double Eps = 1.0e-09;
template <typename T>
bool IsEqual(const T a, const T b) {
  return std::abs(a - b) < Eps;
}
template <typename T>
bool IsGreater(const T a, const T b) {
  return a > b + Eps;
}
template <typename T>
bool IsLess(const T a, const T b) {
  return a + Eps < b;
}
template <typename T>
bool IsGreaterEqual(const T a, const T b) {
  return !IsLess(a, b);
}
template <typename T>
bool IsLessEqual(const T a, const T b) {
  return !IsGreater(a, b);
}
template <typename T>
std::string ToStr(const T& val) {
  std::ostringstream ostr;
  ostr << val;
  return ostr.str();
}
template <typename T>
bool FromStr(const std::string& str, T& val) {
  std::istringstream istr(str);
  istr >> val;
  return !!istr;
}
template <typename T>
std::istream& operator>>(std::istream& ist, std::vector<T>& data) {
  ;
  for (size_t i = 0; i < data.size(); i++) {
    ist >> data[i];
  }
  return ist;
}
template <typename T>
T Read(std::istream& ist) {
  ;
  T val;
  ist >> val;
  return val;
}
template <typename T>
std::ostream& operator<<(std::ostream& ost, const std::vector<T>& data) {
  for (size_t i = 0; i < data.size(); i++) {
    if (i != 0) {
      ost << ' ';
    }
    ost << data[i];
  }
  return ost;
}
template <size_t id>
class StopWatch {};
char GetMainLetter(const std::string& s) {
  ;
  std::map<char, size_t> cn;
  for (size_t i = 0; i < s.size(); i++) {
    const char c = s[i];
    cn[c] += 1;
  };
  for (char c = 'A'; c <= 'Z'; c++) {
    if (cn[c] == 2) return c;
  };
  return '0';
}
size_t GetMainDistance(const std::string& s, const char c, size_t& p,
                       size_t& q) {
  p = s.find(c);
  ;
  q = s.find(c, p + 1);
  ;
  ;
  return q - p;
}
const char FreeCell = '.';
void Put(int32_t& x, int32_t& y, const char c, std::vector<std::string>& ans) {
  const int32_t dx[] = {0, -1, -1, 0, +1};
  const int32_t dy[] = {-1, 0, +1, +1, 0};
  for (size_t i = 0; i < 5; i++) {
    int32_t nx = x + dx[i];
    int32_t ny = y + dy[i];
    if (nx < 0 || nx >= (int32_t)ans.size()) continue;
    if (ny < 0 || ny >= (int32_t)ans[0].size()) continue;
    if (ans[nx][ny] == FreeCell) {
      ans[nx][ny] = c;
      x = nx;
      y = ny;
      return;
    }
  };
}
void Fill(int32_t& x, int32_t& y, const std::string& s,
          std::vector<std::string>& ans) {
  for (size_t i = 0; i < s.size(); i++) {
    Put(x, y, s[i], ans);
  }
}
bool TryGetAns(const std::string& s, std::vector<std::string>& ans) {
  const char mainLetter = GetMainLetter(s);
  size_t pos1 = s.size();
  size_t pos2 = s.size();
  const size_t mainDistance = GetMainDistance(s, mainLetter, pos1, pos2);
  if (mainDistance <= 1) return false;
  ans.resize(2);
  ans[0] = std::string(13, FreeCell);
  ans[1] = std::string(13, FreeCell);
  const std::string beginPart = s.substr(0, pos1);
  const std::string internalPart = s.substr(pos1 + 1, mainDistance - 1);
  const std::string endPart = s.substr(pos2 + 1);
  const int32_t x0 = 1;
  const int32_t y0 = (mainDistance + 1) / 2 - 1;
  {
    int32_t x = x0;
    int32_t y = y0;
    Fill(x, y, internalPart, ans);
  }
  {
    int32_t x = x0;
    int32_t y = y0;
    Fill(x, y, endPart, ans);
    Fill(x, y, beginPart, ans);
  };
  ans[x0][y0] = mainLetter;
  return true;
}
bool Solve(std::istream& ist, std::ostream& ost, const bool multipleTestMode) {
  StopWatch<1> sw;
  (void)sw;
  std::string s;
  ist >> s;
  if (multipleTestMode && !ist) return false;
  if (!g_isLocalPrintEnabled) {
  } else
    std::cerr << std::endl << "Next test" << std::endl;
  std::vector<std::string> ans;
  if (TryGetAns(s, ans)) {
    ;
    ;
    ;
    ost << ans[0] << std::endl;
    ost << ans[1] << std::endl;
    ;
    return multipleTestMode;
  } else {
    ost << "Impossible" << std::endl;
  }
  return multipleTestMode;
}
int main(int argc, const char* argv[]) {
  std::ios_base::sync_with_stdio(false);
  std::istream* ist = &std::cin;
  std::ostream* ost = &std::cout;
  std::unique_ptr<std::istream> fileInput;
  if (argc > 1) {
    fileInput.reset(new std::ifstream(argv[1]));
    if (!(*fileInput)) {
      std::cout << "File not found: " << argv[1] << std::endl;
    }
    ist = fileInput.get();
  }
  Solve(*ist, *ost, false);
}
