Write a program that prints the character at position n of a given string.
Input contains several lines. Each line of input consists of a string s followed by a number n separated by a single space. For each line of input, there should be a line of output containing the character in position n of the corresponding string s.
Each given string has at most 60 characters.
Positions are indexed from 0. If the number given on the input is 0, you should print the first character; if the number given on the input is 1, you should print the second character; if the number given on the input is 2, you should print the third character; etc.
abcdef 0
xyz 2
Hello 1
World 4
a
z
e
d
Section 4.8. Sequences of the Computer Science by Example book discusses how to deal with sequences of values, including how to perform indexing of strings.
try next: repeat-list
Copyright © 2020-2022 Rudy Matela
All rights reserved