
输入样例:
18013820100
结尾无空行
输出样例:
int[] arr = new int[]{8,3,2,1,0};
int[] index = new int[]{3,0,4,3,1,0,2,4,3,4,4};

var s = '18013820100';
var arr = Array.from(new Set(s.split(''))).map(i => parseInt(i)).sort(function (a,b) {return b-a });
var kv = {};
arr.forEach((v, index) => { kv[v] = index });
var index = [];
s.split('').forEach(v => { index.push(kv[v]) });
console.log(arr,index)