//---------------------------------------------------------Instructions--------------------------------------------------------------------------------- /*Plzz dont reads the comments Follow the page "https://www.hackerearth.com/notes/standard-template-library//" You will come to know more than that written in comments. Thank you `LAL RISHAV /*---------------------------------------------------------string--------------------------------------------------------------*/ /*append(): Inserts additional characters at the end of the string (can also be done using ‘+’ or ‘+=’ operator). Its time complexity is O(N) where N is the size of the new string. assign(): Assigns new string by replacing the previous value (can also be done using ‘=’ operator). at(): Returns the character at a particular position (can also be done using ‘[ ]’ operator). Its time complexity is O(1). begin(): Returns an iterator pointing to the first character. Its time complexity is O(1). clear(): Erases all the contents of the string and assign an empty string (“”) of length zero. Its time complexity is O(1). compare(): Compares the value of the string with the string passed in the parameter and returns an integer accordingly. Its time complexity is O(N + M) where N is the size of the first string and M is the size of the second string. copy(): Copies the substring of the string in the string passed as parameter and returns the number of characters copied. Its time complexity is O(N) where N is the size of the copied string. c_str(): Convert the string into C-style string (null terminated string) and returns the pointer to the C-style string. Its time complexity is O(1). empty(): Returns a boolean value, true if the string is empty and false if the string is not empty. Its time complexity is O(1). end(): Returns an iterator pointing to a position which is next to the last character. Its time complexity is O(1). erase(): Deletes a substring of the string. Its time complexity is O(N) where N is the size of the new string. find(): Searches the string and returns the first occurrence of the parameter in the string. Its time complexity is O(N) where N is the size of the string. insert(): Inserts additional characters into the string at a particular position. Its time complexity is O(N) where N is the size of the new string. length(): Returns the length of the string. Its time complexity is O(1). replace(): Replaces the particular portion of the string. Its time complexity is O(N) where N is size of the new string. resize(): Resize the string to the new length which can be less than or greater than the current length. Its time complexity is O(N) where N is the size of the new string. size(): Returns the length of the string. Its time complexity is O(1). substr(): Returns a string which is the copy of the substring. Its time complexity is O(N) where N is the size of the substring.*/ //------------------------------------------------------------------Vectors-------------------------------------------------------------------------------------- /*at(): Returns the reference to the element at a particular position (can also be done using ‘[ ]’ operator). Its time complexity is O(1). back(): Returns the reference to the last element. Its time complexity is O(1). begin(): Returns an iterator pointing to the first element of the vector. Its time complexity is O(1). clear(): Deletes all the elements from the vector and assign an empty vector. Its time complexity is O(N) where N is the size of the vector. empty(): Returns a boolean value, true if the vector is empty and false if the vector is not empty. Its time complexity is O(1). end(): Returns an iterator pointing to a position which is next to the last element of the vector. Its time complexity is O(1). erase(): Deletes a single element or a range of elements. Its time complexity is O(N + M) where N is the number of the elements erased and M is the number of the elements moved. front(): Returns the reference to the first element. Its time complexity is O(1). insert(): Inserts new elements into the vector at a particular position. ts time complexity is O(N + M) where N is the number of elements inserted and M is the number of the elements moved . pop_back(): Removes the last element from the vector. Its time complexity is O(1). push_back(): Inserts a new element at the end of the vector. Its time complexity is O(1). resize(): Resizes the vector to the new length which can be less than or greater than the current length. Its time complexity is O(N) where N is the size of the resized vector. size(): Returns the number of elements in the vector. Its time complexity is O(1).*/ /*vector a; // empty vector of ints vector b (5, 10); // five ints with value 10 vector c (b.begin(),b.end()); // iterating through second vector d (c);*/ //-------------------------------------------------------------------Lists------------------------------------------------------------------------------------ /*begin( ): It returns an iterator pointing to the first element in list.Its time complexity is O(1). end( ): It returns an iterator referring to the theoretical element(doesn’t point to an element) which follows the last element.Its time complexity is O(1). empty( ): It returns whether the list is empty or not.It returns 1 if the list is empty otherwise returns 0.Its time complexity is O(1). assign( ): It assigns new elements to the list by replacing its current elements and change its size accordingly.It time complexity is O(N). back( ): It returns reference to the last element in the list.Its time complexity is O(1). erase( ): It removes a single element or the range of element from the list.Its time complexity is O(N). front( ): It returns reference to the first element in the list.Its time complexity is O(1). push_back( ): It adds a new element at the end of the list, after its current last element. Its time complexity is O(1). push_front( ): It adds a new element at the beginning of the list, before its current first element. Its time complexity is O(1). remove( ): It removes all the elements from the list, which are equal to given element. Its time complexity is O(N). pop_back( ): It removes the last element of the list, thus reducing its size by 1. Its time complexity is O(1). pop_front( ): It removes the first element of the list, thus reducing its size by 1. Its time complexity is O(1). insert( ): It insert new elements in the list before the element on the specified position. Its time complexity is O(N). reverse ( ): It reverses the order of elements in the list. Its time complexity is O(N). size( ): It returns the number of elements in the list. Its time complexity is O(1).*/ //-------------------------------------------------------------------------Pairs--------------------------------------------------------------------------------- /*pair p1; // default pair p2 (1, ‘a’); // value inititialization p1 = make_pair(2, ‘b’);*/ //------------------------------------------------------------------Sets-------------------------------------------------------------------------------------- /*set s1; // Empty Set int a[]= {1, 2, 3, 4, 5, 5}; set s2 (a, a + 6); // s2 = {1, 2, 3, 4, 5} set s3 (s2); // Copy of s2 set s4 (s3.begin(), s3.end()); // Set created using iterators begin(): Returns an iterator to the first element of the set. Its time complexity is O(1). clear(): Deletes all the elements in the set and the set will be empty. Its time complexity is O(N) where N is the size of the set. count(): Returns 1 or 0 if the element is in the set or not respectively. Its time complexity is O(logN) where N is the size of the set. empty(): Returns true if the set is empty and false if the set has at least one element. Its time complexity is O(1). end(): Returns an iterator pointing to a position which is next to the last element. Its time complexity is O(1). erase(): Deletes a particular element or a range of elements from the set. Its time complexity is O(N) where N is the number of element deleted. find(): Searches for a particular element and returns the iterator pointing to the element if the element is found otherwise it will return the iterator returned by end(). Its time complexity is O(logN) where N is the size of the set. insert(): insert a new element. Its time complexity is O(logN) where N is the size of the set. size(): Returns the size of the set or the number of elements in the set. Its time complexity is O(1). */ //---------------------------------------------------------------------Maps---------------------------------------------------------------------------------- //------------------------------------------------------Main Program starts here------------------------------------------------------------------------------- #include #define pb push_back #define mp make_pair #define s(a) sort(a.begin(),a.end()) #define vecll vector #define vecs vector #define vecpll vector > #define rep(i,a,b) for(long long int (i)=(a);(i)<(b);(i)++) #define repr(i,b,a) for(long long int (i)=(b);(i)>=(a);(i)--) #define fast_IO ios_base::sync_with_stdio(false);cin.tie(0); #define while_tc long long int t;cin>>t;while(t--) #define ispow2(n) (n&&(!(n&(n-1)))) ///check if its perfect power of 2 #define MOD 1000000007 typedef long long int ll; inline ll gcd(ll a, ll b){while(a%=b^=a^=b^=a); return b;} inline ll lcm(ll a, ll b){return (a*(b/gcd(a,b)));} /*vector a(100000); vector b(100000); ll find(vector a,ll num)*/ using namespace std; int main() { ll a[26]; ll max=10000000; rep(i,0,27) { cin>>a[i]; } string s; cin>>s; rep(i,0,s.length()) { if(a[s[i]-'a']>max) max=a[s[i]]; } ll ans=max*s.length(); cout>>ans; }