Utkarsh and Placement tests CodeChef Solution

Problem – Utkarsh and Placement tests CodeChef Solution

This website is dedicated for CodeChef solution where we will publish right solution of all your favourite CodeChef problems along with detailed explanatory of different competitive programming concepts and languages.
<<Previous CodeChef Problem Next Codechef Problem>>

Utkarsh and Placement tests CodeChef Solution in C++17

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--){
	    char a,b,c,x,y;
	    cin>>a>>b>>c>>x>>y;
	    if(a==x||a==y)
	    cout<<a<<endl;
	    else if(b==x||b==y)
	   cout<<b<<endl;
	   else
	   cout<<c<<endl;
	}
	return 0;
}

Utkarsh and Placement tests CodeChef Solution in C++14

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--){
	    char a,b,c,x,y;
	    cin>>a>>b>>c>>x>>y;
	    
        if(x==a)
        cout<<x<<endl;
        else if(y==a)
        cout<<y<<endl;
        else if(x==b)
        cout<<x<<endl;
         else if(y==b)
        cout<<y<<endl;
         else if(x==c)
        cout<<x<<endl;
        else
        cout<<y<<endl;
    }
	    
	
	return 0;
}

Utkarsh and Placement tests CodeChef Solution in PYTH 3

# cook your dish here
t=int(input())
for i in range(t):
    a=list(map(str,input().split()))
    b=list(map(str,input().split()))
    for j in range(3):
        for k in range(2):
            if a[j]==b[k]:
                print(b[k])
                break
        if a[j]==b[k]:
            break

Utkarsh and Placement tests CodeChef Solution in C

#include <stdio.h>

int main(void) {
    int t;
    scanf("%d",&t);
    while(t--)
    {
        char a,b,e;
        scanf(" %c %c %c ",&a,&b,&e);
        
        char c,d;
        scanf(" %c %c ",&c,&d);
        if(c==a||d==a)
        printf("\n%c",a);
        else if(c==b||d==b)
        printf("\n%c",b);
        else if(c==e||d==e)
        printf("\n%c",e);
    }
	// your code goes here
	return 0;
}

Utkarsh and Placement tests CodeChef Solution in 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
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		while(n-->0)
		{
		    char[] ch=new char[3];
		    char[] ch1=new char[2];
		    for(int i=0;i<3;i++)
		    {
		        ch[i]=sc.next().charAt(0);
		    }
		    for(int i=0;i<2;i++)
		    {
		        ch1[i]=sc.next().charAt(0);
		    }
		    for(int i=0;i<3;i+=3)
		    {
		        for(int j=0;j<2;j+=2)
		        {
		           if(ch[i]==ch1[j])
		           {
		               System.out.println(ch1[j]);
		           }
		           else if(ch[i]==ch1[j+1])
		           {
		               System.out.println(ch1[j+1]);
		           }
		           else if(ch[i+1]==ch1[j])
		           {
		               System.out.println(ch1[j]);
		           }
		           else if(ch[i+1]==ch1[j+1])
		           {
		               System.out.println(ch1[j+1]);
		           }
		           else if(ch[i+2]==ch1[j])
		           {
		               System.out.println(ch1[j]);
		           }
		           else if(ch[i+2]==ch1[j+1])
		           {
		               System.out.println(ch1[j+1]);
		           }
		        }
		    }
		}
	}
}

Utkarsh and Placement tests CodeChef Solution in PYPY 3

t = int(input())
for _ in range(t):
    f, s, t = input().split()
    x, y = input().split()
    
    pref = [f, s, t]
    offers = [x, y]
    
    for i in pref:
        if i not in offers:
            pref.remove(i)
    print(pref[0])

Utkarsh and Placement tests CodeChef Solution in PYTH

t = int(raw_input())
for i in range(t):
	st = raw_input().split()
	pst = raw_input().split()
	found = False
	p = 0
	while not found:
		if st[p] in pst:
			found = True
			print st[p]
		else:
			p += 1
		# endif
	# endwhile
# endfor i

Utkarsh and Placement tests CodeChef Solution in C#

using System;

public class Test
{
	public static void Main()
	{
		// your code goes here
		int t = int.Parse(Console.ReadLine());
		while(t-->0){
		    string[] str = Console.ReadLine().Split(" ");
		    char first =  char.Parse(str[0]);
		    char second = char.Parse(str[1]);
		    char third = char.Parse(str[2]);
		    string[] str1 = Console.ReadLine().Split(" ");
		    char x =  char.Parse(str1[0]);
		    char y = char.Parse(str1[1]);
		    if(x==first || y==first){
		        Console.WriteLine(first);
		    }
		    else if(x==second||y==second){
		        Console.WriteLine(second);
		    }
		    else{
		        Console.WriteLine(third);
		    }
		}
	}
}

Utkarsh and Placement tests CodeChef Solution in NODEJS

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

function readLine() {
    return inputString[currentLine++];
}

function main() {
    const tests = parseInt(readLine(), 10);
    
    for( let i=0; i<tests; i++ ) {
        let preferances  = readLine().split(' ');
        let offers = readLine();
        
        console.log(findOfferAccepted( preferances, offers ));
        
    }
}

function findOfferAccepted(preferances, offers) {
    let set = new Set();
    
    for( let i=0; i<offers.length; i++ ) {
        set.add(offers[i]);
    }
    
    for( let i=0; i<offers.length; i++ ) {
        if( set.has(preferances[i]) ) return preferances[i];

    }
}


Utkarsh and Placement tests CodeChef Solution in GO

package main

import (
	"bufio"
	"os"
	"strconv"
)

var (
	scanner *bufio.Scanner
	writer  *bufio.Writer
)

func main() {
	// setup
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	writer = bufio.NewWriter(os.Stdout)
	pref := make([]rune, 3)
	allot := make([]rune, 2)
	for c := scanInt(); c > 0; c-- {
		for i := 0; i < 3; i++ {
			pref[i] = scanChar()
		}
		for i := 0; i < 2; i++ {
			allot[i] = scanChar()
		}
		// could use hashmap but generally slower
		if allot[0] == pref[0] {
			writer.WriteRune(allot[0])
		} else if allot[1] == pref[0] {
			writer.WriteRune(allot[1])
		} else if allot[0] == pref[1] {
			writer.WriteRune(allot[0])
		} else if allot[1] == pref[1] {
			writer.WriteRune(allot[1])
		}
		writer.WriteString("\n")
	}
	writer.Flush()
}

func scanInt() int {
	scanner.Scan()
	x, err := strconv.ParseInt(scanner.Text(), 10, 32)
	if err != nil {
		panic("cannot convert input to Int")
	}
	return int(x)
}

func scanChar() rune {
	scanner.Scan()
	return []rune(scanner.Text())[0]
}
Utkarsh and Placement tests CodeChef Solution Review:

In our experience, we suggest you solve this Utkarsh and Placement tests CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.

If you are stuck anywhere between any coding problem, just visit Queslers to get the Utkarsh and Placement tests CodeChef Solution.

Find on CodeChef

Conclusion:

I hope this Utkarsh and Placement tests CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.

This Problem is intended for audiences of all experiences who are interested in learning about Programming Language in a business context; there are no prerequisites.

Keep Learning!

More Coding Solutions >>

Cognitive Class Answer

CodeChef Solution

Microsoft Learn

Leave a Reply

Your email address will not be published. Required fields are marked *