itertools.combinations_with_replacement()

  • + 0 comments

    # Enter your code here. Read input from STDIN. Print output to STDOUT

    from itertools import combinations_with_replacement

    char_input , length = input().split() char_input = ''.join(sorted(char_input.upper())) length = int(length)

    combination = combinations_with_replacement(char_input,length)

    for comb in combination: print(''.join(comb))