Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int cnt[10];
- int main() {
- char c;
- while(cin >> c && c != '.') {
- if (c == '.') break;
- cnt[c - '0']++;
- }
- bool q = 0;
- int x = -1;
- for (int i = 0; i < 10; i++) {
- if (cnt[i]%2 == 1) {
- if (!q) {
- q = 1;
- x = i;
- }
- else {
- cout << "NO" << endl;
- return 0;
- }
- }
- }
- cout << "YES" << endl:
- string s = "";
- for (int i = 0; i < 10; i++) {
- for (int j = 0; j < cnt[i]/2; j++) {
- s += (char) (i + '0');
- }
- }
- cout << s;
- reverse(s.begin(), s.end());
- if (q) cout << x;
- cout << s;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement