#include <iostream>
using namespace std;
int main() {
int N;
char symbol;
cin >> N >> symbol;
int maxRows = 1; // 最大行数
int remainingSymbols = N; // 剩余符号数
// 计算最大行数
while (2 * maxRows * maxRows - 1 <= N) {
maxRows++;
}
maxRows--;
// 打印上半部分
for (int i = 0; i < maxRows; i++) {
for (int j = 0; j < i; j++) {
cout << " ";
}
for (int j = 0; j < 2 * maxRows - 1 - 2 * i; j++) {
cout << symbol;
remainingSymbols--;
}
cout << endl;
}
// 打印中间行
for (int i = 0; i < maxRows - 1; i++) {
cout << " ";
}
cout << symbol << endl;
remainingSymbols--;
// 打印下半部分
for (int i = maxRows - 1; i >= 0; i--) {
for (int j = 0; j < i; j++) {
cout << " ";
}
for (int j = 0; j < 2 * maxRows - 1 - 2 * i; j++) {
cout << symbol;
remainingSymbols--;
}
cout << endl;
}
cout << remainingSymbols << endl;
return 0;
}