Skip to content

Commit

Permalink
ABC366B Vertical Writing
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicfred committed Aug 12, 2024
1 parent 6fd60bd commit 0647d74
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions atcoder/abc366b_vertical_writing.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Vicfred
// https://atcoder.jp/contests/abc366/tasks/abc366_b
// implementation
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
int N;
cin >> N;
vector<string> S(N);
for (int i = 0; i < N; ++i) {
cin >> S[i];
}
int M = 0;
for (int i = 0; i < N; ++i) {
M = max(M, (int)S[i].length());
}
vector<string> T(M, string(N, '*'));
for (int i = 0; i < N; ++i) {
for (int j = 0; j < (int)S[i].size(); ++j) {
T[j][N - i - 1] = S[i][j];
}
}
for (int i = 0; i < M; ++i) {
while (T[i].back() == '*') {
T[i].pop_back();
}
cout << T[i] << endl;
}
return 0;
}

0 comments on commit 0647d74

Please sign in to comment.