Please Explain Failed Test Cases

#include
#include
using namespace std;

bool decInc(string s){
if(s.size()<=2){
return true;
}

int i=0;
while(s[i]>s[i+1] && i+1<s.size()){
	cout<<s[i]<<"d"<<endl;
	i++;
}
i++;
bool check=true;
while(s[i]<s[i+1] && (i+1)<s.size()){
	cout<<s[i]<<"i"<<endl;
	i++;
}
if(i!=s.size()-1){
	check=false;
}
return check;

}
int main() {
string s;
cin>>s;
if(decInc(s)){
cout<<“true”;
}
else{
cout<<“false”;
}
return 0;
}

hi @nakshjain,
the question says that you need to check if the the whole array can be partitioned somewhere such that initial numbers are increasing and remaining are decreasing

eg 1 2 3 4 9 8 7 6 can be divided into 1 2 3 4 5 9 (increasing) and 8 7 6 (decreasing)

for implementation difficulties check this I’ve commented properly https://ide.codingblocks.com/s/656052