Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <conio.h>
- using namespace std;
- string read() {
- string s;
- char ch;
- do {
- ch = getch();
- if (!isdigit(ch)) {
- break;
- }
- s += ch;
- } while(true);
- return s;
- }
- int main() {
- string s = read();
- int n = s.size();
- //top part
- for (int i = 0; i < (n + 1) / 2; i++) {
- cout << string(i, ' ') + s.substr(i, n - i * 2) << endl;
- }
- //bottom part
- for (int i = (n + 1) / 2 - 1; i >= 0; i--) {
- cout << string(i, ' ') + s.substr(i, n - i * 2) << endl;
- }//*/
- return 0;
- }
Add Comment
Please, Sign In to add comment