[NOIP2007]字符串的展开 牛子过90% 洛谷AC
https://ac.nowcoder.com/acm/contest/20960/1001
走过路过的大佬来看看秋梨膏QAQ
python写的,不是,哥们,为什么在洛谷能ac,真晕了
a, b, c = map(int, input().split()) S = input() p = S.find('-') while p != -1: if p == len(S) - 1 or 0: p = S.find('-', p + 1) continue l, r = S[p - 1], S[p + 1] ole, ori = ord(l), ord(r) tmp = '' if (l.isdigit() and r.isdigit()) or (l.isalpha() and r.isalpha()): if ori > ole: if a != 3: for i in range(ole + 1, ori): if chr(i).isalpha() and a == 2: nc = chr(i).upper() else: nc = chr(i) tmp += nc * b else: nc = '*' tmp += nc * b * (ori - ole - 1) if c == 2: tmp = tmp[::-1] S = S[:p] + tmp + S[p + 1:] p = S.find('-', p + 1) print(S)