提交时间:2022-08-03 17:23:28
运行 ID: 56985
#include<bits/stdc++.h> using namespace std; int main() { int i,n,d=0,g=0,z=0; char n1,n2; cin>>n; for(i=1;i<=n;i++){ cin>>n1>>n2; if(n1=='D')d++; if(n1=='G')g++; if(n1=='Z')z++; if(n2=='D')d--; if(n2=='G')g--; if(n2=='Z')z--; } cout<<"D "<<d<<endl<<"G "<<g<<endl<<"Z "<<z; return 0; }