Skip to content

Instantly share code, notes, and snippets.

@alexcambose
Last active June 20, 2018 09:14
Show Gist options
  • Save alexcambose/22861737b94666a9c6b43d4dee046bbf to your computer and use it in GitHub Desktop.
Save alexcambose/22861737b94666a9c6b43d4dee046bbf to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;
int n, i, l;
char s[200], cuv[200];
int main() {
//cin.getline(cuv, 200);
strcpy(cuv, "TPQAREDSXMRYIUVE");
strcpy(s, " ");
strcat(s, cuv);
l = strlen(s);
n = sqrt(l);
i = n;
while(i < l-1) {
cout << s[i];
i += n-1;
}
i=1;
while(i < l) {
cout << s[i];
i += n+1;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment