SHARE
TWEET

Untitled

lalalalalalalaalalla Jul 8th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <iomanip>
  5. #include <queue>
  6. #include <cmath>
  7. #include <algorithm>
  8. #include <tuple>
  9. #include <iomanip>
  10. #include <stdio.h>
  11. #include <numeric>
  12. #include <map>
  13. #include <math.h>
  14. #include <bitset>
  15.  
  16. #define int long long
  17. #define ull unsigned long long
  18. #define all(a) a.begin(), a.end()
  19. #define pii pair<int, int>
  20. #define pb push_back
  21.  
  22. using namespace std;
  23.  
  24. const double PI = 3.14159265358;
  25.  
  26. long long gcd(long long a, long long b) {
  27.     if (a==0) return b;
  28.     if (b==0) return a;
  29.     if (a>b) return gcd(a%b,b); else return gcd(b%a,a);
  30. }
  31. int prime(int p) {
  32.     for (int i=2;i*i<=p;i++) {
  33.         if (p%i==0 && i<p) return 0;
  34.     }
  35.     return 1;
  36. }
  37.  
  38. double s(int x1, int y1, int x2, int y2) {
  39.     return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  40. }
  41.  
  42. signed main()
  43. {
  44.     ios_base::sync_with_stdio(0);
  45.     cin.tie(0);
  46.     cout.tie(0);
  47.     string a;
  48.     cin >> a;
  49.     for (int i = 0; i < 26; i++) {
  50.         if (a[i] >= 'A' and a[i] <= 'Z') a[i] = char((a[i] - 'A') + 'a');
  51.     }
  52.     string s = a;
  53.     sort(all(s));
  54.     bool f = true;
  55.     for (int i = 0; i < 26; i++) {
  56.         if (s[i] - 'a' < i) f = false;
  57.     }
  58.     vector<int> ans(26, -1);
  59.     if (f) {
  60.         for (int i = 0; i < 26; i++) {
  61.             for (int j = 0; j < 26; j++) {
  62.                 if (a[j] == s[i] and ans[j] == -1) {ans[j] = i + 1; break;}
  63.             }
  64.         }
  65.         cout << "\n";
  66.         cout << "YES\n";
  67.         for (int i = 0; i < 26; i++) cout << ans[i] << " ";
  68.     } else cout << "NO";
  69. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top