# Tanu and Head-bob | CodeChef Solution

Hello coders, today we are going to solve Tanu and Head-bob CodeChef Solution whose Problem Code is HEADBOB.

Tanu has got interested in signs and gestures that we use for communication. One such gesture is the head-bob.
When we want to signal “Yes” to someone, we move the head up-and-down. For “No”, the head is moved left-and-right, rotating about the vertical axis.
There is a peculiar way of gesturing “Yes”, commonly seen in India, by moving head sideways (rotating about the forward-back axis). This is called the Indian head-bob.

Tanu observed many people on the railways station, and made a list of gestures that they made. Usual “Yes” gesture is recorded as “Y“, no as “N” and Indian “Yes” gesture as “I“. (Assume no foreigner uses the Indian “Yes” gesture and vice-versa). Identify which of them were Indians, which were not Indian, and which one you cannot be sure about.

## Input Format

First line contains T, number of people observed by Tanu.
Each person is described in two lines. First line of the description contains a single integer N, the number of gestures recorded for this person. Next line contains a string of N characters, each character can be “Y”, “N” or “I”.

## Output Format

For each person, print “INDIAN” if he/she is from India, “NOT INDIAN” if not from India, and “NOT SURE” if the information is insufficient to make a decision.

## Constraints

• For 30 points: 1 ≤ T,N ≤ 100
• For 70 points: 1 ≤ T,N ≤ 1000

Example

Sample Input

``````3
5
NNNYY
6
NNINNI
4
NNNN
``````

Sample Output

``````NOT INDIAN
INDIAN
NOT SURE``````

## Solution – Tanu and Head-bob

### C++

```#include<bits/stdc++.h>
#define int long long int
using namespace std;
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t=1;
cin>>t;
while(t--){
int n;
cin>>n;
string str;
cin>>str;
int I = 0;
int N = 0;
int Y = 0;
for (int i = 0; i < n; ++i) {
if (str[i]=='N'){
N++;
} else if (str[i]=='I'){
I++;
} else{
Y++;
}
}
if (I>0 && Y==0){
cout<<"INDIAN\n";
} else if (Y>0 && I==0){
cout<<"NOT INDIAN\n";
} else{
cout<<"NOT SURE\n";
}
}
}```

### Python

```# cook your dish here
for _ in range(int(input(""))):
num1 = int(input(""))
num2 = list(input(""))
if "Y" in num2:
print("NOT INDIAN")
elif "I" in num2:
print("INDIAN")
else:
print("NOT SURE")
```

### Java

```/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0)
{
int a=sc.nextInt();
String s=sc.next();
int f1=0,f2=0;
for (int i = 0; i < a; i++) {
if(s.charAt(i) == 'I'){
f1++;
break;
}
else if(s.charAt(i) == 'Y'){
f2++;
break;
}

}
if(f1>0){
System.out.println("INDIAN");
}
else if(f2>0){
System.out.println("NOT INDIAN");
}
else{
System.out.println("NOT SURE");
}

}
}
}
```

Disclaimer: The above Problem (Tanu and Head-bob) is generated by CodeChef but the Solution is Provided by CodingBroz. This tutorial is only for Educational and Learning Purpose.