Skip to content

Commit 2d9b1d9

Browse files
committed
Algorithms: Linear Search
1 parent 8cf3eac commit 2d9b1d9

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Manna is extremely disappointed to find out that no one in his college knows his first name. Even his classmates call
2+
# him only by his last name. Frustrated, he decides to make his fellow college students know his first name by forcing
3+
# them to solve this question.
4+
#
5+
# You are given a long string as input in each testcase, containing any ASCII character. Your task is to find out the
6+
# number of times SUVO and SUVOJIT appears in it.
7+
#
8+
# Note: This problem must be solved in C language only.
9+
#
10+
# Input Format
11+
# The first line contains the number of testcases, T. Next, T lines follow each containing a long string S.
12+
#
13+
# Output Format
14+
# For each long string S, display the no. of times SUVO and SUVOJIT appears in it.
15+
#
16+
# Constraints
17+
#
18+
# 1 <= T <= 100
19+
# 1 <= Length of each string <= 150
20+
#
21+
# SAMPLE INPUT
22+
# 3
23+
# SUVOJITSU
24+
# 651SUVOMN
25+
# $$$$$SUVOSUVOJIT$$$$$
26+
#
27+
# SAMPLE OUTPUT
28+
# SUVO = 0, SUVOJIT = 1
29+
# SUVO = 1, SUVOJIT = 0
30+
# SUVO = 1, SUVOJIT = 1
31+
32+
testCases = int(input())
33+
for _ in range(testCases):
34+
suvojit = 0
35+
suvo = 0
36+
s = input()
37+
suvojit = s.count("SUVOJIT")
38+
suvo = s.count("SUVO")
39+
print('SUVO = ',suvo-suvojit,', SUVOJIT = ',suvojit,sep='')

0 commit comments

Comments
 (0)