Advertisement
Guest User

Untitled

a guest
Nov 18th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. commands = input()
  2. char = commands[0]
  3. line = [char]
  4. x = 0
  5. for command in commands:
  6.     if command == '<':
  7.         line[x - 1] = char
  8.         x -= 1
  9.     elif command == '>':
  10.         line.append(char)
  11.         x += 1
  12.     elif command == 'V':
  13.         print(*line, sep='')
  14.         line.clear()
  15.         for i in range(x):
  16.             line.append(' ')
  17.         line.append(char)
  18. print(*line, sep='')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement