emitL CodeChef Solution

Problem -emitL 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.

emitL CodeChef Solution in C++14

#include <iostream>
#include <vector>
using namespace std;

int main() {
	// your code goes here
	long long t;
	cin>>t;
	while(t--){
	    string s;
	    cin>>s;
	    
	    vector<long long>v(5,0);
	     bool f=1;
	    long long n=s.size();
	    if(n<9){
	        cout<<"NO"<<endl;
	    }
	   
	    else if(n==9){
	        
	        for(int i=0; i<n; i++){
	            if(s[i]=='L'){
	                v[0]++;
	            }
	            if(s[i]=='T'){
	                v[1]++;
	            }
	            if(s[i]=='I'){
	                v[2]++;
	            }
	            if(s[i]=='M'){
	                v[3]++;
	            }
	            if(s[i]=='E'){
	                v[4]++;
	            }
	            
	        }
	        for(int i=0; i<4; i++){
	            if(v[i]!=2){
	                f=0;
	            }
	        }
	        if(v[4]!=1){
	            f=0;
	        }
	        
	        if(f==0){
	            cout<<"NO"<<endl;
	        }
	        else{
	            cout<<"YES"<<endl;
	        }
	        
	    }
	    else{
	         for(int i=0; i<n; i++){
	            if(s[i]=='L'){
	                v[0]++;
	            }
	            if(s[i]=='T'){
	                v[1]++;
	            }
	            if(s[i]=='I'){
	                v[2]++;
	            }
	            if(s[i]=='M'){
	                v[3]++;
	            }
	            if(s[i]=='E'){
	                v[4]++;
	            }
	            
	        }
	        
	        for(int i=0; i<5; i++){
	            if(v[i]<2){
	                f=0;
	            }
	        }
	        if(f==0){
	            cout<<"NO"<<endl;
	        }
	        else{
	            cout<<"YES"<<endl;
	        }
	        
	    }
	    
	    
	}
	return 0;
}

emitL CodeChef Solution in PYTH 3

# cook your dish here
def solve(s):
    
    if len(s) < 5:
        return 'NO'
    mp = {
        'L': 0,
        'T':0,
        'I':0,
        'M':0,
        'E':0
    }
    for i in range(len(s)):
        if s[i] in mp:
            mp[s[i]] += 1
    
    
    # return mp.values()
    for key,val in mp.items():
        
        if val < 2:
            if key == 'E' and len(s) == 9:
                continue
            else:
                return 'NO'
    
    return 'YES'
    


for _ in range(int(input())):
    
    s = input()
    
    print(solve(s))
    
    

emitL CodeChef Solution in C

#include <stdio.h>
#include <string.h>

int main ()
{
    int y;
    
    scanf( "%d", &y);
    
    while (y--)
    
    {
        
        char string[101];
        
        scanf( "%s", string );
        

        int length = strlen(string);
        
        int count[5] = {0}; 
        
        for ( int i = 0 ; i <= length - 1 ; i++ )
        
        {
            switch ( string[i] )
            
            {
                case 'L':
                
                    count[0]++;
                    
                    break;
                case 'T':
                    count[1]++;
                    break;
                case 'I':
                    count[2]++;
                    break;
                case 'M':
                    count[3]++;
                    break;
                case 'E':
                    count[4]++;
                    break;
            }
        }

        if ( length <= 8 )
        {
            printf( "NO\n" );
        }
        else if ( length == 9 )
        {
            if ( count[0] == 2 && count[1] == 2 && count[2] == 2 && count[3] == 2 && count[4] == 1 )
            {
                printf( "YES\n" );
            }
            else
            {
                printf( "NO\n" );
            }
        }
        else 
        {
            if ( count[0] >= 2 && count[1] >= 2 && count[2] >= 2 && count[3] >= 2 && count[4] >= 2 )
            {
                printf( "YES\n" );
            }
            else
            {
                printf( "NO\n" );
            }
        }

    }
} 

emitL 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
	{
	Scanner sc = new Scanner(System.in);
	int t = sc.nextInt();
	while(t-->0){
	    String s = sc.next();
	    long counte =0,countm =0,counti =0,countt =0,countl =0;
	    for(int i=0; i<s.length();i++){
	        char ch = s.charAt(i);
	        if(ch=='E')
	        counte++;
	        else if(ch=='M')
	        countm++;
	        else if(ch=='I')
	        counti++;
	        else if(ch=='T')
	        countt++;
	        else if(ch=='L')
	        countl++;
	        
	    }if(s.length()>9){
	    if(counte>1 &&countm>1 &&counti>1 &&countt>1 &&countl>1)
	    System.out.println("YES");
	    else
	        System.out.println("NO");
	    }else if(s.length()==9){
	    if(counte>=1 &&countm>1 &&counti>1 &&countt>1 &&countl>1)
	    System.out.println("YES");
	    else
	        System.out.println("NO");
	    }else{
	        System.out.println("NO");
	    }
	}
	}
}

emitL CodeChef Solution in PYPY 3

t=int(input())
while t>0:
    t-=1 
    s=str(input())
    arr=[0,0,0,0,0]
    for i in s:
        if i.lower()=='l':
            arr[0]+=1 
        elif i.lower()=='t':
            arr[1]+=1 
        elif i.lower()=='i':
            arr[2]+=1 
        elif i.lower()=='m':
            arr[3]+=1 
        elif i.lower()=='e':
            arr[4]+=1 
    if arr[0]>1 and arr[1]>1 and arr[2]>1 and arr[3]>1 and arr[4]>1:
        print("YES")
    elif arr[0]>1 and arr[1]>1 and arr[2]>1 and arr[3]>1 and arr[4]==1:
        if len(s)==9:
            print("YES")
        else:
            print("NO")
    else:
        print("NO")

emitL CodeChef Solution in PYTH

t = int(raw_input())
for i in range(t):
	st = raw_input().strip()
	A = [0 for x in range(91)]
	for x in st:
		n = ord(x)
		A[n] += 1
	# endfor x
	if (A[76] > 1) and (A[84] > 1) and (A[73] > 1) and (A[77] > 1) and (A[69] > 0):
		res = 'YES'
	else:
		res = 'NO'
	# endif
	if (len(st) > 9) and (A[69] == 1):
		res = 'NO'
	# endif
	print res
# endfor i

emitL CodeChef Solution in C#

    using System;

    class Salem
    {
        public static bool checkLetter(string strin, char[] letters, int times)
        {
            int index;
            for (int i = 0; i < times; i++ )
            {
                index = strin.IndexOf(letters[i]);
                if (index != -1)
                {
                    if (strin.IndexOf(letters[i], ++index) == -1)                
                        return false;
                }
                else
                    return false;
            }
            if (strin.Contains("E"))
                return true;
            else
                return false;
        }

        public static void Main()
        {
            int amount = int.Parse(Console.ReadLine());
            for (int t = 0; t < amount; t++)
            {
                string str = Console.ReadLine();
                char[] search = { 'L', 'T', 'I', 'M', 'E'};

                if (str.IndexOfAny(search) == -1 || str.Length < 9)
                {
                    Console.WriteLine("NO");
                }
                else if (str.Length == 9)
                {
                    bool flag = checkLetter(str, search, 4);
                    if (flag == false)
                        Console.WriteLine("NO");
                    else                    
                        Console.WriteLine("YES");
                }
                else if (str.Length > 9)
                {
                    bool flag = checkLetter(str, search, 5);
                    if (flag == false)
                        Console.WriteLine("NO");
                    else
                        Console.WriteLine("YES");
                }
            }
            return;
        }
    }

emitL CodeChef Solution in GO

package main

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

func nextInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}

func nextString(scanner *bufio.Scanner) string{
	scanner.Scan()
	str := scanner.Text()
	return str
}

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1000000)
	scanner := bufio.NewScanner(reader)
	scanner.Split(bufio.ScanWords)
	cases := nextInt(scanner)
	for i:= 0; i < cases; i++ {
		arr := [26]int{0}
		str := nextString(scanner)
		for _, val := range str {
			if val == 'L' || val == 'T' || val == 'I' || val == 'M' || val == 'E' {
				arr[val-65] += 1
			}
		}

		if len(str) == 9 && arr['L' - 65] == 2 && arr['T' - 65] == 2 && arr['I' - 65] == 2 && arr['M' - 65] == 2 && arr['E' -65] == 1 {
			fmt.Println("YES")
		} else if arr['L' - 65] > 1 && arr['T' - 65] > 1 && arr['I' - 65] > 1 && arr['M' - 65] > 1 && arr['E' -65] > 1 {
			fmt.Println("YES")
		} else {
			fmt.Println("NO")
		}
	}
}
emitL CodeChef Solution Review:

In our experience, we suggest you solve this emitL 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 emitL CodeChef Solution.

Find on CodeChef

Conclusion:

I hope this emitL 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 *