diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -12,7 +12,7 @@
         before = 0
         after = len(s) - 1
         l = [i for i in s]
-        while before <= len(s):
+        while before <= len(s) / 2:
             l[before] = min(l[before], l[after])
             l[after] = l[before]
             before += 1
