Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <queue>
- #include <stack>
- #include <map>
- #include <algorithm>
- #include <numeric>
- #include <functional>
- #include <set>
- #include <sstream>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <cmath>
- #include <cctype>
- #include <climits>
- #include <fstream>
- #include <time.h>
- #define FOR(i,a,b) for(int i=(a);i<(b);++i)
- #define FORE(i,a,b) for(int i=(a);i<=(b);++i)
- #define REP(i,n) FOR(i,0,n)
- #define REPE(i,n) FORE(i,0,n)
- #define FOE(i,a) for(auto i : a)
- #define ALL(c) (c).begin(), (c).end()
- #define DUMP(x) cerr << #x << " = " << (x) << endl;
- #define SUM(x) std::accumulate(ALL(x), 0L)
- using namespace std;
- struct MiddleCode {
- string s;
- string encode(string _s) {
- s = _s;
- string t = "";
- while (s.size() != 0) {
- int half = s.size() / 2;
- int del_idx = half;
- if (s.size() % 2 == 0 && s[half - 1] < s[half]) {
- del_idx = half - 1;
- }
- t += s[del_idx];
- s.erase(del_idx, 1);
- }
- return t;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement