Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
Problema adhoc
La idea es usar un map,y un arreglo de numeros como string para evitar la conversion de int a string
**/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <string>
using namespace std;
string s;
string numbers[]={"1","5","3","4","2","9","7","8","6","10","11","15","13","14","12","19","17","18","16","50","51","55","53","54","52","59"};
int main(){
while(cin>>s){
map <char,string> M;
for(int i=0,aux=0;i<s.size();i++){
if(M[s[i]]==""){
M[s[i]]=numbers[aux];
aux++;
}
}
string res="";
for(int i=0;i<s.size();i++){
res+=M[s[i]];
}
cout<<res<<endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.