Skip to content

Instantly share code, notes, and snippets.

@TheoKlein
Created July 18, 2016 11:43
Show Gist options
  • Select an option

  • Save TheoKlein/1f95559fda9f334147635e588bcc2585 to your computer and use it in GitHub Desktop.

Select an option

Save TheoKlein/1f95559fda9f334147635e588bcc2585 to your computer and use it in GitHub Desktop.
ZeroJudge c045
#include <iostream>
using namespace std;
int main() {
int index = 0;
unsigned long int max = 0;
string input;
char array[100][100] = {' ' , ' '};
while(getline(cin , input)){
for(int i = 0 ; i < input.length() ; ++i)
array[index][i] = input[i];
if(input.length() > max)
max = input.length();
index++;
}
for(int i = 0 ; i < max ; ++i){
for(int j = index - 1 ; j >= 0 ; --j){
if(array[j][i] == '\0')
cout << ' ';
else
cout << array[j][i];
}
cout << endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment