#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define NN 300005
#define pb push_back
#define mp make_pair
#define INF (((ll)1000000000) * ((ll)1000000000))
#define inf 0x7fffffff
#define inff 100000
#define ff first
#define ss second
#define MOD 1000000007
#define fast cin.sync_with_stdio(0);cin.tie(0)
#define rep(i,N) for(int i=0;i<N;i++)
#define frep(i,a,b) for(int i=a;i<=b;i++)
#define pii pair<int,int>
#define fill(A,v) memset(A,v,sizeof(A))
#define setbits(x) __builtin_popcount(x)
#define print(A,j,k) for(int ii=j;ii<=k;ii++)cout<<A[ii]<<" ";cout<<"\n"
#define all(x) (x).begin(), (x).end()
#define gcd __gcd
#define SQRT 350
set<pii > S;
set<pii >::iterator it;
int dot[NN];
int solve(int len) {
int ans=0;
while(len>1) {
ans+=len/2;
if(len%2==0)
len/=2;
else
len=len/2+1;
}
return ans;
}
int main(int argc, char const *argv[])
{
fast;
int n,q;
cin>>n>>q;
string s;
cin>>s;
S.clear();
int ans=0;
for(int i=0;i<s.size();) {
if(s[i]=='.') {
dot[i+1]=1;
i++;
int start=i-1,end=start;
while(s[i]=='.' && i<s.size()) {
dot[i+1]=1;
end=i;
i++;
}
ans+=solve(end-start+1);
//cout<<"insering "<<start+1<<" "<<end+1<<"\n";
S.insert(mp(start+1,end+1));
}
else
i++;
}
//cout<<"current "<<ans<<"\n";
int p;
string c;
while(q--) {
cin>>p>>c;
if(dot[p] && c==".") {
}
else if(!dot[p] && c!=".") {
}
//dot replaced by letter
else if(dot[p] && c!=".") {
dot[p]=false;
it=S.upper_bound(mp(p,-inf));
if(it==S.end())
it--;
while(it->ff > p )
it--;
int l=it->ff,r=it->ss;
ans-=solve(r-l+1);
S.erase(it);
if(l==r);
else if(p==l) {
S.insert(mp(p+1,r));
ans+=solve(r-p);
}
else if(p==r){
S.insert(mp(l,r-1));
ans+=solve(r-l);
}
else {
S.insert(mp(l,p-1));
ans+=solve(p-l);
S.insert(mp(p+1,r));
ans+=solve(r-p);
}
}
//letter replaced by dot
else if(!dot[p] && c==".") {
//cout<<"here\n";
dot[p]=true;
int l=-1,r=-1;
it=S.upper_bound(mp(p-1,-inf));
while(it->ff>=p && it!=S.begin())
it--;
if(it->ss==p-1) {
//cout<<"jere\n";
l=it->ff;
r=p-1;
ans-=solve(r-l+1);
S.erase(it);
}
r++;
it=S.upper_bound(mp(p+1,-inf));
if(it==S.end()) ;
else if(it->ff==p+1){
r=it->ss;
ans-=solve(it->ss-it->ff+1);
S.erase(it);
}
if(l!=-1 && r!=-1) {
S.insert(mp(l,r));
ans+=solve(r-l+1);
}
}
cout<<ans<<"\n";
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgojZGVmaW5lIGxsIGxvbmcgbG9uZyBpbnQKI2RlZmluZSBOTiAzMDAwMDUKI2RlZmluZSBwYiBwdXNoX2JhY2sKI2RlZmluZSBtcCBtYWtlX3BhaXIKI2RlZmluZSBJTkYgKCgobGwpMTAwMDAwMDAwMCkgKiAoKGxsKTEwMDAwMDAwMDApKQojZGVmaW5lIGluZiAweDdmZmZmZmZmCiNkZWZpbmUgaW5mZiAxMDAwMDAKI2RlZmluZSBmZiBmaXJzdAojZGVmaW5lIHNzIHNlY29uZAojZGVmaW5lIE1PRCAxMDAwMDAwMDA3CiNkZWZpbmUgZmFzdCBjaW4uc3luY193aXRoX3N0ZGlvKDApO2Npbi50aWUoMCkKI2RlZmluZSByZXAoaSxOKSBmb3IoaW50IGk9MDtpPE47aSsrKQojZGVmaW5lIGZyZXAoaSxhLGIpIGZvcihpbnQgaT1hO2k8PWI7aSsrKQojZGVmaW5lIHBpaSBwYWlyPGludCxpbnQ+CiNkZWZpbmUgZmlsbChBLHYpIG1lbXNldChBLHYsc2l6ZW9mKEEpKQojZGVmaW5lIHNldGJpdHMoeCkgX19idWlsdGluX3BvcGNvdW50KHgpCiNkZWZpbmUgcHJpbnQoQSxqLGspIGZvcihpbnQgaWk9ajtpaTw9aztpa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