diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -13,7 +13,7 @@
     else:
         count = 0
 
-if max == len(S) and S[0] == "-" and S[len(S) - 1] == "-":
+if max == len(S) and S[0] != "-" and S[len(S) - 1] != "-":
     print(-1)
 elif max == 0:
     print(-1)
