#include <bits/stdc++.h>
#define LL long long
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<n;i++)
#define REV(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define pri(a) cout<<a<<endl
#define prii(a,b) cout<<a<<" "<<b<<endl
#define hi printf("Hello World\n")
#define WRITE(fn) freopen(fn, "w", stdout);
#define pcs printf("Case %d: ", ++cs);
using namespace std;
/// If you’ve already reached the end of one of the strings, print a space.
int main()
{
string s[105];
int i = 0, mxln=-1;
while(getline(cin,s[i++]))
{
mxln = max(mxln, SZ(s[i-1]));
}
int totalstring = i-1;
REP(i,mxln)
{
REV(j,totalstring)
{
if(SZ(s[j]) > i) /// in the coln, if mx col len exceeds the len of that string then, print space
{
printf("%c", s[j][i]);
}
else
printf(" ");
}
printf("\n");
}
return 0;
}
No comments:
Post a Comment