输入一组数字,中间以逗号隔开,数字越大优先级越高,0优先级最高,按输入的数字,打印优先级,数字相同时前面1个数字的优先级高于后面1个数字

样例:

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

输入   1,3,3,2

输出   3,0,1,2

if __name__ == '__main__':
    s = input().split(',')
    s1 = list(sorted(s,reverse=True))
    result = []
    popties =[x for x in range(len(s))]
    for x in s:
    tmp = s1.index(x)
    result.append(popties[tmp])
    s1.pop(tmp)
   popties.pop(tmp)
   print(result)

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄