#include <iostream> #include <string> using namespace std; int f(string s){ int res = 0, i, j; for(i = 0; i < s.size(); i++){ if(s[i] == '.'){ j = i; while(s[j] == '.'){ j++; } res += j - i - 1; i = j; } } return res; } int main(){ int length, times, position, i; char replace_ch; string s; while(cin >> length >> times >> s){ for(i = 0; i < times; i++){ cin >> position >> replace_ch; s[position - 1] = replace_ch; cout << f(s) << endl;; } } }
点赞 评论

相关推荐

不愿透露姓名的神秘牛友
05-28 12:15
点赞 评论 收藏
分享
06-25 09:33
厦门大学 Java
程序员饺子:现在日常估计没啥hc了,等到八月多估计就慢慢有了。双九✌🏻不用焦虑的
投递快手等公司7个岗位
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务