提交时间:2022-08-03 14:36:49

运行 ID: 56780

#include <bits/stdc++.h> using namespace std; int n,a[1000]={0}; int main(){ cin>>n; getchar(); while(n--){ char x,y; x=getchar(); getchar(); y=getchar(); getchar(); a[x]--; a[y]++; } cout<<"D"<<" "<<a['D']<<endl; cout<<"G"<<" "<<a['G']<<endl; cout<<"Z"<<" "<<a['Z']; return 0; }