提交时间:2022-08-03 14:51:45
运行 ID: 56803
#include<bits/stdc++.h> using namespace std; int n,x1,x2,x3; char a,b; int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a>>b; if(a=='D'&&b=='G') x1++,x2--; if(a=='G'&&b=='Z') x2++,x3--; if(a=='D'&&b=='Z') x1++,x3--; if(a=='G'&&b=='D') x2++,x1--; if(a=='Z'&&b=='G') x3++,x2--; if(a=='Z'&&b=='D') x3++,x1--; } cout<<"D"<<" "<<x1<<endl; cout<<"G"<<" "<<x2<<endl; cout<<"Z"<<" "<<x3<<endl; return 0; }