MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

Hackerrank_problems/Designer PDF Viewer/solution.c:4–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include<string.h>
3
4int main(){
5
6 int a[26],max=0,ascii;
7 char c[10];
8
9 for(int i=0;i<26;i++)
10 scanf("%d",&a[i]); //reading inputs and storing them in the integer array
11
12 scanf("%s",c); //reading the string
13
14 int len=strlen(c); //calculating length
15
16 for(int i=0;i<len;i++){
17
18 ascii=c[i]-97; //finding out the integer equivalent in our integer array from each character of the string to get the maximum height
19
20 if(a[ascii]>max)
21 max=a[ascii]; //stores the maximum height
22
23 }
24
25 printf("%d",len*max); //printing the result
26 return 0;
27
28}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected