Submission
Status:
----------
Subtask/Task Score:
0/100
Score: 0
User: speedbuffalo99
Problemset: ห่วงโซ่ (Chain)
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-15 15:41:07
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int h;
string s;
cin >> s;
cin >> h;
int row = 2 * h + 1;
int step = 2 * h;
int col = (int)s.size() * step + 1;
vector<string> a(row, string(col, '.'));
for (int k = 0; k < (int)s.size(); k++) {
int start = k * step;
for (int i = 0; i < row; i++) {
int left = h - abs(h - i);
int right = h + abs(h - i);
a[i][start + left] = s[k];
a[i][start + right] = s[k];
}
}
for (int i=0;i<row;i++) {
cout << a[i] << '\n';
}
return 0;
}