# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
165620 | itiam | Elder (COCI19_elder) | Cpython 3 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <algorithm>
using namespace std;
int L[30];
int main(){
char bla='E';
string vla,X,Y;
int N,br=1;
cin >> vla >> N;
//char pr_vla=(char)vla[0];
L[(int)((char)vla[0])-65]=1;
//cout << (int)((char)vla[0])-65;
for (int i=0;i<N;i++){
cin >> X >> Y;
if (Y==vla){
vla=X;
if (L[(int)((char)vla[0])-65]!=1){
L[(int)((char)vla[0])-65]=1;
br+=1;
}
}
}
cout << vla << "\n";
cout << br;
/*string a[]={"a","c","b","h","d",},x="c",y="e";
bool exists = find(begin(a), end(a),y) != end(a);
cout << exists;
*/
return 0;
}