Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- #include <iomanip>
- #include <queue>
- #include <cmath>
- #include <algorithm>
- #include <tuple>
- #include <iomanip>
- #include <stdio.h>
- #include <numeric>
- #include <map>
- #include <math.h>
- #include <bitset>
- #define int long long
- #define ull unsigned long long
- #define all(a) a.begin(), a.end()
- #define pii pair<int, int>
- #define pb push_back
- using namespace std;
- const double PI = 3.14159265358;
- long long gcd(long long a, long long b) {
- if (a==0) return b;
- if (b==0) return a;
- if (a>b) return gcd(a%b,b); else return gcd(b%a,a);
- }
- int prime(int p) {
- for (int i=2;i*i<=p;i++) {
- if (p%i==0 && i<p) return 0;
- }
- return 1;
- }
- double s(int x1, int y1, int x2, int y2) {
- return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
- }
- signed main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- string a;
- cin >> a;
- for (int i = 0; i < 26; i++) {
- if (a[i] >= 'A' and a[i] <= 'Z') a[i] = char((a[i] - 'A') + 'a');
- }
- string s = a;
- sort(all(s));
- bool f = true;
- for (int i = 0; i < 26; i++) {
- if (s[i] - 'a' < i) f = false;
- }
- vector<int> ans(26, -1);
- if (f) {
- for (int i = 0; i < 26; i++) {
- for (int j = 0; j < 26; j++) {
- if (a[j] == s[i] and ans[j] == -1) {ans[j] = i + 1; break;}
- }
- }
- cout << "\n";
- cout << "YES\n";
- for (int i = 0; i < 26; i++) cout << ans[i] << " ";
- } else cout << "NO";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement