const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void (async function () {
const arr = (await readline()).split(",").map(Number);
let i = 0;
const map = {};
arr.forEach((element, idx) => {
map[idx] = [element];
});
console.log(map);
while (arr.length > 0) {
const nowVal = arr.shift();
const isMax = arr.every((item) => item <= nowVal);
if (isMax) {
let idx = Object.keys(map).filter((item) => map[item] == nowVal);
idx = idx[0];
map[idx] = [...map[idx], i];
i++;
} else {
arr.push(nowVal);
}
}
console.log(map);
const ans = [];
Object.keys(map).forEach((val, key) => {
ans.push(map[val][1]);
});
console.log(ans.join(","));
})();