Last active
June 20, 2018 09:14
-
-
Save alexcambose/22861737b94666a9c6b43d4dee046bbf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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