string search

Hi,
i have a problem that i can't figure out on my own. How to check in string if first or second character is for example small letter or "." and then the program would calculate how many words like this user had typed on keyboard. This is the full task i was given to do: Write a program that reads the string of subtitles until it encounters a string equal to the first string read, and then reads the string N of the subtitles (N - constant). Print the information on the number of subtitles between the two subtitles read in succession, starting with a digit followed by a period. Thanks.
string s = ".a more words";
if(s[0] == '.' || (s[0] >= 'a' && s[0] <= 'z')

and same for s[1]
Last edited on
Topic archived. No new replies allowed.