#include <iostream>
using namespace std;
bool SNT(int n) {
if(n < 2)
return 0;
for(int i = 2; i*i <= n; i++) {
if(n%i == 0)
return 0;
}
return 1;
}
int main() {
int a[] = { 5,5,7,8,9,7,5,3,2 };
int n = sizeof(a)/sizeof(n);
int max_length = 0,index = -1;
for(int i = 0; i < n; i++) {
if(SNT(a[i])) {
int length = 1,temp_index = i;
while(SNT(a[i+1])) {
length++;
i++;
}
if(max_length < length) {
max_length = length;
index = temp_index;
}
}
}
for(int i = index; i < n; i++) {
if(SNT(a[i]))
cout << a[i] << " ";
else
break;
}
cout << endl;
cout << "Max length: " << max_length << endl;
return 0;
}