Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdio>
- #include <string>
- using namespace std;
- string n;
- char mat[15][15];
- int s,a,r,rmax,sk,x;
- int main()
- {
- cin>>n;
- a=n.length();
- s=1;
- do{
- r=0;
- r=a/s;
- if (r*s==a)
- if (r>rmax){
- rmax=r;
- sk=s;
- }
- ++s;
- }while((a/s)<=s);
- x=0;
- for (int i=0; i<sk;++i) {
- for (int j=0;j<rmax;++j){
- mat[j][i]=n[j+x];
- }
- x+=4;
- }
- for (int i=0;i<rmax;++i){
- for (int j=0;j<sk;++j){
- cout<< mat[i][j];}
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment