提交时间:2022-08-03 14:47:56

运行 ID: 56799

#include<bits/stdc++.h> using namespace std; int n,D,G,Z; char a,b; int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a>>b; if(a=='D') D++; if(a=='G') G++; if(a=='Z') Z++; if(b=='D') D--; if(b=='G') G--; if(b=='Z') Z--; } cout<<"D "<<D<<endl<<"G "<<G<<endl<<"Z "<<Z; return 0; }