#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define inf 0x3f3f3f3f
const int mod=1e9+7;
const int N=2e5+5;
int n,m;
int a[N];
void solve(){
string s;
cin>>s;
map<int,int>mp;
vector<int>v;
for(auto i:s){
if(find(v.begin(),v.end(),i-'0')==v.end()){
v.push_back(i-'0');
}
}
sort(v.begin(),v.end());
reverse(v.begin(),v.end());
cout<<"int[] arr = new int[]{";
for(int i=0;i<v.size();i++){
mp[v[i]]=i;
cout<<v[i];
if(i!=v.size()-1) cout<<",";
}
cout<<"};"<<endl;
cout<<"int[] index = new int[]{";
int f=1;
for(auto i:s){
if(f) f=0;
else cout<<",";
cout<<mp[i-'0'];
}
cout<<"};";
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int tt=1;
// cin>>tt;
while(tt--) solve();
return 0;
}
L1-027 出租PTA
最新推荐文章于 2024-11-04 19:24:37 发布