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
orLTIME108
, 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
- Each of the contest codes will be either
START38
orLTIME108
.
Sample 1:
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 : There are START38
s in the input, which means that there were problems in START38
. Similarly, there was problem in LTIME108
.
Test case : There is START38
in the input, which means that there was problem in START38
. Similarly, there were problems in LTIME108
.
Test case : There are no START38
s in the input, which means that were problems in START38
. Similarly, there were problems in LTIME108
.
Test case : There are START38
s in the input, which means that there were problems in START38
. Similarly, there were 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
Post a Comment