#include
#include
#include
int main()
{
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
std::string x, y;
std::cin >> x >> y;
//1
bool same= false;
for (auto i : x){
for (auto j : y){
if (i == j) {same = true; break;}
}
if (same) break;
}
std::cout << std::boolalpha << same;</span>
//2
for (unsigned int i = 0; i < x.size(); ++i)
if (x[i] == 'а' || x[i] == 'б')x.insert(x.begin() + i, x[i]);
std::cout << x;</span>
return 0;
}