SimeonTs

SUPyF2 Text-Processing-Lab - 02. Repeat Strings

Oct 26th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. """
  2. Text Processing - Lab
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1739#1
  4.  
  5. SUPyF2 Text-Processing-Lab - 02. Repeat Strings
  6.  
  7. Problem:
  8. Write a program that reads an array of strings.
  9. Each string is repeated N times, where N is the length of the string. Print the concatenated string.
  10.  
  11. Examples:
  12. Input:          Output:
  13. hi abc add      hihiabcabcabcaddaddadd
  14. work            workworkworkwork
  15. ball            ballballballball
  16. """
  17.  
  18. # Solution #1:
  19. # strings = input().split()
  20. # result = ""
  21. # for word in strings:
  22. #     length = len(word)
  23. #     result += word * length
  24. # print(result)
  25.  
  26. # Solution #2:
  27. print(''.join([word * len(word) for word in input().split()]))
Add Comment
Please, Sign In to add comment