Submission #397477

#TimeUsernameProblemLanguageResultExecution timeMemory
397477IwanttobreakfreeMarko (COCI15_marko)C++17
50 / 50
32 ms1028 KiB
#include <iostream> #include <string> #include <map> using namespace std; int main(){ int n; string str,id; cin>>n; map<char,char> tradu; map<string,int> words; char c='a'; for(int i=0;i<26;i++){ if(i<3)tradu.insert(make_pair(c,'2')); else if(i<6)tradu.insert(make_pair(c,'3')); else if(i<9)tradu.insert(make_pair(c,'4')); else if(i<12)tradu.insert(make_pair(c,'5')); else if(i<15)tradu.insert(make_pair(c,'6')); else if(i<19)tradu.insert(make_pair(c,'7')); else if(i<22)tradu.insert(make_pair(c,'8')); else tradu.insert(make_pair(c,'9')); c++; } while(n--){ id=""; cin>>str; int m=str.length(); for(int i=0;i<m;i++){ id+=tradu[str[i]]; } if(words.find(id)==words.end())words.insert(make_pair(id,1)); else words[id]++; } cin>>str; if(words.find(str)==words.end())cout<<0; else cout<<words[str]; }
#Verdict Execution timeMemoryGrader output
Fetching results...