#K83467. Construct a Valid Taco String
Construct a Valid Taco String
Construct a Valid Taco String
Given a positive integer \( n \), your task is to construct a string of length \( n \) using only the characters 'a'
, 'b'
, and 'c'
.
The generated string must satisfy the following conditions:
- No two consecutive
'b'
characters appear (i.e. the substring"bb"
is forbidden). - The string does not contain the substrings \( abc \) or \( cba \) anywhere.
You may output any valid string that meets these constraints.
inputFormat
The input consists of a single positive integer \( n \) provided via standard input (stdin), which specifies the required length of the string.
outputFormat
Output a valid string of exactly \( n \) characters to standard output (stdout) using only the characters 'a'
, 'b'
, and 'c'
. The string must satisfy the following:
- No two consecutive
'b'
characters. - It must not contain the substrings \( abc \) or \( cba \).
1
a