Check If Word Is Valid After Insertion

medium
1. You are given a string s determine if it is valid or not.
2. A valid string is a string that can be created by inserting abc at any index any number of times.

Example:
aabcbc can be created 
"" -> "<span style="text-decoration: underline;">abc</span>" -> "a<span style="text-decoration: underline;">abc</span>bc"

while it is impossible to create abccba.

Input Format

Input is managed for you

Output Format

Output is managed for you

Constraints

1: s consists of letters 'a', 'b', and 'c' only.

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
aabcbc
Output
true
Previous
Max-stack
Next
Moving Average From Data Stream

Related Questions