summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--substring.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/substring.cc b/substring.cc
index 243024c..55aa319 100644
--- a/substring.cc
+++ b/substring.cc
@@ -14,7 +14,7 @@ int main()
void s(int i, int k, int n, char str[])
{
- if(i < n){
+ if(i < n - k){
if(i < n-k) for(int j = i; j < i+k; j++) cout << str[j];
cout << "\n";
s(i+=1, k, n, str);