#K2421. Find the First Occurrence of a Character in a String

    ID: 24733 Type: Default 1000ms 256MiB

Find the First Occurrence of a Character in a String

Find the First Occurrence of a Character in a String

You are given a string ( s ) and a character ( c ). Your task is to find the first occurrence of the character ( c ) in the string ( s ). If the character is found, output its 0-based index; otherwise, output (-1). This problem tests your ability to work with strings and search for characters efficiently.

inputFormat

The input consists of two lines. The first line contains the string ( s ), and the second line contains the character ( c ).

outputFormat

Output a single integer representing the 0-based index of the first occurrence of character ( c ) in string ( s ). If ( c ) is not found in ( s ), output (-1).## sample

hello
l
2