| 24 | #include<bits/stdc++.h> |
| 25 | using namespace std; |
| 26 | int main() |
| 27 | { |
| 28 | int n; //define length vriable |
| 29 | cin>>n; //tajing length vriable |
| 30 | string s,s1; //define two strings |
| 31 | cin>>s; //taking the cncoded string |
| 32 | s1=s[0]; //start transform it to the original form |
| 33 | if(n%2==0){ //we check if the length is even |
| 34 | for(int i=1;i<n;i++){ //we loop through the string elements of the endcoded one |
| 35 | if(i%2!=0) s1+=s[i]; //we add it in the second and swap this step it the next iteration |
| 36 | else s1=s[i]+s1; //we add it in the first and swap this step it the next iteration |
| 37 | } |
| 38 | } |
| 39 | else{ |
| 40 | for(int i=1;i<n;i++){//the same as even but with different coditions to start with te right condition only |
| 41 | if(i%2==0) s1+=s[i]; |
| 42 | else s1=s[i]+s1; |
| 43 | } |
| 44 | } |
| 45 | cout<<s1; |
| 46 | } |
nothing calls this directly
no outgoing calls
no test coverage detected