Advertisement
gruslan

shag_2019_11_tip_2

Apr 1st, 2023
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. from math import factorial
  2.  
  3. word = word_out = ' ' + input() + ' '
  4.  
  5. for i in set(word.split()):
  6.     len_i = len(i)
  7.  
  8.     TF = False
  9.     if len_i == 1:
  10.         TF = True
  11.     elif len_i % 2 == 0:
  12.         for j in range(10000):
  13.             factorial_j = factorial(j)
  14.             if factorial_j > len_i:
  15.                 break
  16.             elif factorial_j == len_i:
  17.                 TF = True
  18.                 break
  19.  
  20.     if TF:
  21.         word_out = word_out.replace(f' {i} ', '  ')
  22.  
  23. print(word_out[1:-1])
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement