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