Submission #100972

#TimeUsernameProblemLanguageResultExecution timeMemory
100972KLPPElder (COCI19_elder)C++14
50 / 50
4 ms384 KiB
#include<bits/stdc++.h> using namespace std; typedef long long int lld; int main(){ bool obey[26]; for(int i=0;i<26;i++)obey[i]=false; char c; cin>>c; int C=c-'A'; obey[C]=true; int n; cin>>n; for(int i=0;i<n;i++){ char x,y; cin>>x>>y; if(y==c){ c=x; C=x-'A'; obey[C]=true; } } int ans=0; for(int i=0;i<26;i++)ans+=obey[i]; cout<<c<<endl<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...