提交时间:2022-08-03 17:13:02

运行 ID: 56959

#include<bits/stdc++.h> using namespace std; int n,ans=2; char c,fc; int main(){ cin>>n; cin>>fc; for(int i=2;i<=n;i++){ cin>>c; if(c==fc) continue; else fc=c; ans++; } cout<<ans; return 0; }