CodeChef Problem : Recent contest problems - Difficulty Rating:793

 

CodeChef  Problem  -  Difficulty Rating:793



Input Format

  • First line will contain , number of test cases. Then the test cases follow.
  • Each test case contains of two lines of input.
  • First line of input contains the total count of problems that appeared in the two recent contests - .
  • Second line of input contains the list of  contest codes. Each code is either START38 or LTIME108, to which each problem belongs.

Output Format

For each test case, output two integers in a single new line - the first integer should be the number of problems in START38, and the second integer should be the number of problems in LTIME108.

Constraints

  • 110
  • 11000
  • Each of the contest codes will be either START38 or LTIME108.

Sample 1:

Input
Output
4
3
START38 LTIME108 START38
4
LTIME108 LTIME108 LTIME108 START38
2
LTIME108 LTIME108
6
START38 LTIME108 LTIME108 LTIME108 START38 LTIME108
2 1
1 3
0 2
2 4

Explanation:

Test case 1: There are 2 START38s in the input, which means that there were 2 problems in START38. Similarly, there was 1 problem in LTIME108.

Test case 2: There is 1 START38 in the input, which means that there was 1 problem in START38. Similarly, there were 3 problems in LTIME108.

Test case 3: There are no START38s in the input, which means that were 0 problems in START38. Similarly, there were 2 problems in LTIME108.

Test case 4: There are 2 START38s in the input, which means that there were 2 problems in START38. Similarly, there were 4 problems in LTIME108.


Solution:


def count_problems_in_contests(test_cases):

  for i in test_cases:

    start38_count = i.count('START38')

    ltime108_count = i.count('LTIME108')

    

    print(start38_count, ltime108_count)


if __name__ == "__main__":

    T = int(input())

    test_cases = []

    for _ in range(T):

        N = int(input())

        contest_codes = input().split()

        test_cases.append(contest_codes)

    count_problems_in_contests(test_cases)






Comments

Popular posts from this blog

Convert PDF Files to PPT Files in Python.

Compress PDF using python step by step

Shark Tank India: Focusing on the Innovative Technology Startups

Contact Form

Name

Email *

Message *