What is the problem here

#include<bits/stdc++.h>
using namespace std;

int main(){
char str[10];
cin>>str;
int d=strlen(str);
cout<<d;
int a[d+1]={0};
for(int i=0;str[i]!=’\0’;i++){
a[i]=str[i]-’\0’;
cout<<a[i]<<endl;
}

cout<<str[0];

for(int i=1;i<d;i++){
if(a[i]>=97 && a[i]<=122){
	cout<<str[i];
}
else
cout<<endl;
cout<<str[i];

}

return 0;

}

The approach you are using in your code is wrong… You can use the below approach as,
for(i=0;i<len;i++)
{
if(i==0 && S[i]>=‘A’ && S[i]<=‘Z’)
{
cout<<S[i];
}
else if(S[i]>=‘a’&& S[i]<=‘z’)
{
cout<<S[i];
}
else if(S[i]>=‘A’ && S[i]<=‘Z’)
{
cout<<endl;
cout<<S[i];
}
}