I wrote my own code. It gives wrong output. please check

here is the code.

#include
using namespace std;
int main() {
int n,m,k,s;
cin>>n>>m>>k>>s;
for(int i=0;i<n;i++) {
char o;
for(int j=0;j<m;j++) {
cin>>o;
if(o==’*’)
s+=4;
if(o==’.’)
s-=3;
if(o==’#’){
s-=1;
break;
}
}
s+=1;
}
if(s>=k)
cout<<“Yes\n”<<s;
else
cout<<“No”;
return 0;
}

@priyamthakuria27 dont run your logic simultaneously while taking input,instead store input in a 2D char array then run your logic separately.

what is the mistake?

replied you in the chat,try making code in that way if faces any problem again let me know