Advertisement
gooseyard

Untitled

Sep 26th, 2023
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. #!/usr/bin/python3
  2. import sys
  3.  
  4. line = sys.stdin.readline()
  5. headings = [" " for _ in line]
  6. col = 0
  7. word = False
  8.  
  9. for (i, c) in enumerate(line):
  10.     if not c.isspace():
  11.         if word is False:
  12.             headings[i] = str(col)
  13.             col += 1
  14.             word = True
  15.     else:
  16.         word = False
  17.  
  18. print("".join(headings))
  19. print(line)
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement