Indexes
Statement
Goal
You get a character c and a string s.Your task is to print the sum of all indexes of c in s. The index of the first character is 0!
Example:
c = o
s = hello world
"o" is the fifth and the eighth character: Index 4 + Index 7 = 11
Input
Line 1: A character c
Line 2: A string s
Line 2: A string s
Output
Line 1: The sum of all indexes of c in s. Pay attention on UPPER- and lowercase.
Constraints
Length of c = 1
1 ≤ length of s ≤ 200
1 ≤ length of s ≤ 200
Example
Input
e hello
Output
1
Game modes
Shortest, Reverse
Test cases
Only one index Test
Input
e
hello
Output
1
Validator 1 Validator
Input
s
test
Output
2
Several indexes Test
Input
e
welcome
Output
7
Validator 2 Validator
Input
g
good morning
Output
11
Upper- and lowercase 1 Test
Input
a
What About UPPER- and lowercase?
Output
48
Validator 3 Validator
Input
o
I HOPE YOU payed attention on it!
Output
51
Upper- and lowercase 2 Test
Input
C
Now c is a UPPERCASE Character.
Output
37
Validator 4 Validator
Input
S
THIS is a upper and lowercase TESTCASE
Output
71
c not in s Test
Input
z
The solution is clearly 0.
Output
0
Validator 5 Validator
Input
y
There is no .. in here.
Output
0
Only c in s Test
Input
u
uuuu
Output
6
Validator 6 Validator
Input
k
kkkkk
Output
10
c is a number Test
Input
6
Did you know that about 66% of the surface of the earth are covered by water?
Output
49
Validator 7 Validator
Input
7
This is Validator 7. Did you pass all the 7 validators?
Output
60
Solution language
Solution
Stub generator input