diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -13,7 +13,7 @@
         lps = [0] * n
         j = 0
         for i in range(1, n):
-            if not self.compareChar(s, i, j):
+            while s[i] != s[j] and j > 0:
                 j = lps[j - 1]
 
             if s[i] == s[j]:
