for i in range(t):
for i in s:
if i in d:
if s==‘dadmom’ or s==‘momdad’:
Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile!
Also - please link to the Problem you are trying to solve
In a far away Galaxy of Tilky Way, there was a planet Tarth where the sport of Tompetitive Toding was very popular. According to legends, there lived a setter known to give tricky string DP problems to beginners.
thef and thefina broke into an argument! They had a very lovely child thefi, who just uttered her first word! thef is arguing that thefi said dad , while thefina feels thefi said mom. And now it is upto us to put a stop to the argument!
Hence, given a string S denoting what thefi said, find if she said mom first or dad first or made just some random noise!
We say that thefi said mom if we can find a subsequence of (not necesarily contiguous) characters which spell out mom. Similar rule applies for when we consider her to have said dad.
If thefi said both mom and dad , then we consider the word which she said first. She is considered to have said mom first if we can find a subsequence of characters spelling out mom which ends before any subsequence spelling out dad ends. Otherwise, she is considered to have said dad first.
If she said neither mom nor dad, then she just made a random baby noise and we print Goo-Goo .
This is the question for the problem.
The first line of input contains T - The number of test cases in the file.
The first of each test case contains N , the length of string S.
The next line contains string S , denoting the noise made by Thefi!
For each test case, in a new line -
Print Mom if she said “mom” first.
Print Dad if she said “dad” first.
If she said neither “mom”, nor “dad”, print Goo-Goo
This is the format of input and output