SHARE
TWEET

Untitled

a guest Nov 13th, 2019 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def question5(k, text):
  2.     current_len = 0
  3.     letter = text[0]
  4.     for i in range(1,len(text)):
  5.         if text[i] == letter:
  6.             current_len += 1
  7.  
  8.         else:
  9.             letter = text[i]
  10.             current_len = 1
  11.  
  12.         if current_len == k:
  13.             print(letter*k)
  14.             return
  15.  
  16.     print("no such substring")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top