提交时间:2022-08-03 17:05:38

运行 ID: 56939

#include<bits/stdc++.h> using namespace std; int d,g,z; int main(){ int n; cin>>n;; for(int i=1;i<=n;i++){ char a,b; 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<<endl; }