Author: Ekansh Saxena
Tester: Ujjawal Gupta
Editorial: Ekansh Saxena
String, C++ stl.
Here, we can divide the problem into the two parts:
- Calculate the weight of given friend’s name.
- Check whether he/she will be Kevin’s dream friend or not.
For the first part, Create a variable named “count” to store the weight and then simply loop through the given string and keep incrementing the value of “count” by the weight of each alphabet present in the string.
Weight of ‘d’ can be calculated as ‘d’ - ‘a’.
For the second part, just add “count” with 61 (weight of “Kevin”) and if the result obtained is even then print “YES”, otherwise “NO”.
using namespace std;
//Execution of logical function.
long long count=0,i,j,k;
if(count &1) return “YES”;
//Execution of Main Function.
long long t;