1. 题目
2.思考
map+set
3.代码#include <bits/stdc++.h>
#include<bits/stdc++.h>
using namespace std;
int main()
{
set<int,greater<int>> st;
string nums; int *arr=new int [1000],n=0;
cin>>nums;
for(int i:nums) st.insert(i-48);
for(int i =0;i <nums.size();i++)arr[n++]=distance(st.begin(),find(st.begin(),st.end(),nums[i]-48));
cout<<"int[] arr = new int[]{";
for(int i:st)
{
cout<<i;
if(i!=*--st.end())
cout<<",";
}
cout<<"};"<<endl<<"int[] index = new int[]{";
int i;
for( i=0;i<n-1;i++)
{
cout<<arr[i]<<",";
}
cout<<arr[i]<<"};";
system("pause");
}