#K71132. Generate Strings in Lexicographical Order
Generate Strings in Lexicographical Order
Generate Strings in Lexicographical Order
Given an integer \(N\), generate all strings of length \(N\) using the characters 'a', 'b', and 'c' in lexicographical order. The lexicographical order is defined as the normal dictionary order. For example, when \(N=2\), the valid strings in order are:
aa ab ac ba bb bc ca cb cc
Your task is to implement a program that reads an integer \(N\) from standard input, generates all possible strings of length \(N\) using the characters 'a', 'b', and 'c', and prints each string on a new line in lexicographical order.
Note: The total number of strings generated is \(3^N\).
inputFormat
The input consists of a single line containing an integer \(N\) (where \(1 \leq N \leq 10\)).
outputFormat
Print all strings of length \(N\) composed of the characters 'a', 'b', and 'c' in lexicographical order. Each string should be printed on a new line.
## sample1
a
b
c
</p>