提交时间:2022-08-03 14:46:04
运行 ID: 56796
#include<bits/stdc++.h> using namespace std; int d,g,z; void fun(char c){ if(c=='D') d++; if(c=='G') g++; if(c=='Z') z++; } void fun1(char c){ if(c=='D') d--; if(c=='G') g--; if(c=='Z') z--; } int main(){ int n; char c1,c2; cin>>n; for(int i=1;i<=n;i++){ cin>>c1>>c2; fun1(c1); fun(c2); } cout<<"D "<<d<<endl; cout<<"G "<<g<<endl; cout<<"Z "<<z<<endl; return 0; }