Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma GCC optimize("Ofast")
- #pragma GCC optimize("unroll-loops")
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr), cout.tie(nullptr);
- string s;
- cin >> s;
- vector <string> ans;
- int k = (int)s.size() / 20;
- int n = (int)(s.size());
- if (k == 0) {
- cout << "1 " << s.size() << '\n';
- cout << s;
- } else {
- int t = (int)s.size() % 20;
- if (t == 0) {
- cout << k << " 20\n";
- for (int i = 0; i < k; ++i) {
- for (int j = 0; j < 20; ++j) {
- cout << s[j];
- }
- cout << '\n';
- s = s.substr(20);
- }
- } else if ((int)(s.size() % (k + 1) == 0)) {
- for (int i = 0; i < k; ++i) {
- string text;
- text = s.substr(0, n / (k + 1));
- s = s.substr(n / (k + 1));
- ans.push_back(text);
- }
- ans.push_back(s);
- cout << ans.size() << " " << ans[0].size() << "\n";
- for (int i = 0; i < ans.size(); ++i)
- cout << ans[i] << '\n';
- } else {
- int cnt = k + 1 - n % (k + 1);
- for (int i = 0; i < k; ++i) {
- string text;
- if (cnt > 0) {
- text = s.substr(0, n / (k + 1)) + "*";
- s = s.substr(n / (k + 1));
- cnt--;
- } else {
- text = s.substr(0, n / (k + 1) + 1);
- s = s.substr(n / (k + 1) + 1);
- }
- ans.push_back(text);
- }
- ans.push_back(s);
- cout << ans.size() << " " << ans[0].size() << "\n";
- for (int i = 0; i < ans.size(); ++i)
- cout << ans[i] << '\n';
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement