Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- struct pole{
- char bukva;
- int vrednost;
- };
- int main()
- {
- int i, j, maxi=0, n, tempMaxi=0, l;
- string ime, tempIme, aaa;
- pole azbuka[26];
- for(i=0; i<26; i++)cin >> azbuka[i].bukva >> azbuka[i].vrednost;
- cin >> n;
- for(i=0; i<n; i++)
- {
- cin >> ime;
- for(j=0; j<ime.size(); j++)
- for(l=0; l<26; l++)
- {
- if(ime[j] == azbuka[l].bukva)tempMaxi+=azbuka[l].vrednost;
- else if (int(ime[j])==int(azbuka[l].bukva-32)) tempMaxi+=(azbuka[l].vrednost+20);
- }
- if(maxi<tempMaxi){ maxi = tempMaxi; aaa = ime;}
- tempMaxi = 0;
- }
- cout << aaa;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment