Advertisement
sesquiipedalian

Untitled

Oct 24th, 2023
633
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. def main():
  2.     s = input()
  3.     i = 0
  4.     result = ''
  5.  
  6.     while i < len(s):
  7.         skip = 0
  8.         if s[i] == 'l' and i <= len(s) - 3:
  9.             j = i + 1
  10.             while j < len(s) and s[j] == 'o':
  11.                 j += 1
  12.             if s[j:j + 1] == 'l' and j > i + 1:
  13.                 skip = j - i + 1
  14.         elif s[i] == 'k' and i <= len(s) - 3:
  15.             j = i + 1
  16.             while j < len(s) and s[j] == 'e':
  17.                 j += 1
  18.             if s[j:j + 1] == 'k' and j > i + 1:
  19.                 skip = j - i + 1
  20.        
  21.         if skip > 0:
  22.             i += skip
  23.         else:
  24.             result += s[i]
  25.             i += 1
  26.  
  27.     print(result)
  28.  
  29.  
  30. if __name__ == "__main__":
  31.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement