Guest User

Untitled

a guest
Sep 21st, 2016
192
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import string
  2.  
  3. LOWER = ['_', '.']
  4. UPPER = ['|', ' ']
  5.  
  6. def split_it(s):
  7.     s_lower = ""
  8.     s_upper = ""
  9.  
  10.     for i in range(len(s)):
  11.         if s[i] in string.ascii_lowercase or s[i] in LOWER:
  12.             s_lower += s[i]
  13.         if s[i] in string.ascii_uppercase or s[i] in UPPER:
  14.             s_upper += s[i]
  15.  
  16.     (l, u) = s_lower, s_upper
  17.     return (l,u)
  18.  
  19. def split_rec(s):
  20.     if len(s) == 0:
  21.         return "" , ""
  22.     (l, u) = split_rec(s[1:])
  23.     if s[0] in string.ascii_lowercase or s[0] in LOWER:
  24.         return (s[0] + l, u)
  25.     if s[0] in string.ascii_uppercase  or s[0] in UPPER:
  26.         return (l, s[0] + u)
  27.     return (l, u)
RAW Paste Data