FRIENDS PARTY SOLUTION CODSTAN1

FRIENDS PARTY SOLUTION

Virat likes to play chess, and so does his friend Harshit.
Once Virat wonders, who lose more games will have to give party to the winner.
They played N games in a row, And for each game it is known who lose the game – Harshit or Virat . None of the games ended with a tie.
Help Virat determine which friend will have to give party ?
Input:
The first line of the input contains a single integer N — the number of games played
The second line contains a string s, consisting of N uppercase English letters ′V′ and ′H′ — the outcome of each of the games. The i-th character of the string is equal to ′V′ if the Virat lose the i-th game and ′H′ if Harshit lose the i-th game.
Output:
If Virat ** lose** more games than Harshit , print “Virat” (without quotes) in the only line of the output.
If Harshit lose more games than Virat , print “Harshit” (without quotes) in the only line of the output.
If Virat and Harshit lose the same number of games, print “Friendship” (without quotes)
Constraints
1≤N≤1000000
Sample Input:
6
VHVVVV
7
HHHVVHV
Sample Output:
Virat
Harshit
EXPLANATION:
In the first case, Virat lose 6 games, while Harshit — only 1. Hence, the answer is “Virat”.
In the second case, Virat lose 3 games and Harshit lose 4 games, so the answer is “Harshit”.

Leave a Comment

close
error: Content is protected !!
Free Udemy Courses and Hacking Resources Join Us on TelegramClick Here
+