0_0_37698314_2822.cpp: In function 'int main()': 0_0_37698314_2822.cpp:28:13: error: redeclaration of 'int ans' int ans = lenp - nxt[lenp]; ^ 0_0_37698314_2822.cpp:24:13: note: 'int ans' previously declared here int ans = 0; ^