Taigar2000

E

Oct 17th, 2020 (edited)
451
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # # args = [i[1] for i in input().split()]
  2. f = open('input.txt')
  3. # args = [i[1] for i in f.read().split()]
  4. import sys
  5. # args = [i[1] for i in sys.argv]
  6. args = []
  7. for i in sys.argv:
  8.     for j in i:
  9.         args.append(j)
  10. a = []
  11. ua = []
  12. while(1):
  13. #     b = input()
  14.     b = f.read()
  15.     if(len(b) == 0):
  16.         break
  17.     if('i' in args):
  18.         b = b.lower()
  19.     a.append(b)
  20.  
  21. ua.append([1,a[0]])
  22.  
  23. for i in range(1, len(a)):
  24.     if(a[i] != ua[-1][1]):
  25.         ua.append([1, a[i]])
  26.     else:
  27.         ua[-1][0] += 1
  28. for i in ua:
  29.     if(not (('d' in args) or ('u' in args)) or \
  30.        ('d' in args) and not ('u' in args) and (i[0] > 1) or \
  31.        ('u' in args) and not ('d' in args) and (i[0] == 1)):
  32.         if('c' in args):
  33.             print(i[0], end=' ')
  34.         print(i[1])
  35.  
RAW Paste Data