https://www.hackerrank.com/challenges/designer-pdf-viewer/problem
#include <stdio.h>
#include<string.h>
int main()
{
char word[1000];
int h[26];
for(int i = 0; i < 26; i++)
scanf("%d",&h[i]);
scanf("%s",word);
int max = 0;
int len = strlen(word);
for(int i = 0; i < len; i++)
if(h[word[i] - 'a'] > max)
max = h[word[i] - 'a'];
printf("%d", max * len);
return 0;
}
No comments:
Post a Comment