Submission
Status:
-----PP---
Subtask/Task Score:
20/100
Score: 20
User: speedbuffalo99
Problemset: ห่วงโซ่ (Chain)
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-15 15:19:45
#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 col = (int)s.size()*2*h + 1;
vector<string> a(row, string(col, '.'));
for (int k=0;k<s.size();k++) {
int start = k*(2*h);
for (int i=0;i<=2*h;i++) {
int left, right = 0;
left = abs(h-i);
right = 2*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;
}