Submission #96700

#TimeUsernameProblemLanguageResultExecution timeMemory
96700nandonathanielElder (COCI19_elder)C++14
50 / 50
2 ms376 KiB
#include<bits/stdc++.h>
using namespace std;

bool pernah[26];

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    char now;
    cin >> now;
    pernah[now-'A']=true;
    int n;
    cin >> n;
    for(int i=1;i<=n;i++){
    	char win,lose;
    	cin >> win >> lose;
    	if(lose==now){
    		now=win;
    		pernah[now-'A']=true;
		}
	}
	int ans=0;
	for(int i=0;i<26;i++){
		if(pernah[i])ans++;
	}
	cout << now << endl;
	cout << ans << endl;
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...