题目
求解字符串数字组合
import itertools
s = input()
n = int(input())
numStr = ''.join(sorted(set(filter(str.isdigit, s)), reverse = True))
for s in itertools.combinations(numStr, n):
print(''.join(list(s)))
求解字符串函数组合
from itertools import combinations
a=input()
b=[]
e=[]
c=set()
d=""
t=0
for i in a:
if i.isdigit():
b.append(eval(i))
for i in b:
c.add(i)
n=eval(input())
if n<=len(c):
for i in combinations(c,n):
i=list(i)
i.sort(reverse=True)
while t
d+=str(i[t])
t+=1
e.append(eval(d))
t=0
d=""
e.sort(reverse=True)
for i in e:
print(i)
黑洞
def isHd(n):
num_str= str(n)
max = ''
min = ''
for i in sorted(num_str,reverse = yes):
max += str(i)
for i in sorted(num_str):
min += str(i)
if int(max) - int(min) == n:
return yes
else:
return no
统计单词数-应用
words = ""
while True:
a = input()
if a == "%%%":
break
a = a.lower()
for i in "!.,:*?#012345689