#include<bits/stdc++.h>
using namespace std;
vector<int>v,v2;
int main(){
string s;getline(cin,s);
for(auto x:s) v.push_back(x-'0');
sort(v.begin(),v.end(),[](int a,int b){return a>b;});
v.erase(unique(v.begin(),v.end()),v.end());
string ans;
for(auto x:v){
ans+=(x+'0');
ans+=',';
}
ans.erase(ans.end()-1);
cout<<"int[] arr = new int[]{"<<ans<<"};"<<endl;
for(auto x:s){
for(int i=0;i<v.size();i++){
if((x-'0')==v[i]){v2.push_back(i);break;}
}
}
string temp;
for(auto x:v2){
temp+=(x+'0');
temp+=',';
}
temp.erase(temp.end()-1);
cout<<"int[] index = new int[]{"<<temp<<"};";
}
L1-027 出租 C++
最新推荐文章于 2024-09-09 22:12:12 发布