forked from imabhinav-am/Competetive-Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEncryption.cpp
More file actions
50 lines (46 loc) · 669 Bytes
/
Copy pathEncryption.cpp
File metadata and controls
50 lines (46 loc) · 669 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int main(){
string a;
int i,j,n;
getline(cin, a);
n=a.size();
char b[n];
for(i=0,j=0;i<a.size();i++)
{
if(a[i]==' ')
continue;
b[j]=a[i];
j++;
}
float l=strlen(b);
l=sqrt(l);
int M=floor(l);
int N=ceil(l);
char A[M][N];
int k=0;
for(i=0;i<M;i++)
{
for(j=0;j<N;j++,k++)
A[i][j]=b[k];
}
for(i=0;i<M;i++)
{
for(j=0;j<N;j++)
cout<<A[i][j]<<" ";
cout<<endl;
}
cout<<endl;
for(i=0;i<N;i++)
{
for(j=0;j<M;j++)
cout<<A[j][i];
cout<<" ";
}
return 0;
}