#K1296. One Row Keyboard
One Row Keyboard
One Row Keyboard
Given a string key
, determine whether it can be typed using letters from only one row of a standard QWERTY keyboard. The keyboard rows are defined as follows:
- Row 1: \( QWERTYUIOP \)
- Row 2: \( ASDFGHJKL \)
- Row 3: \( ZXCVBNM \)
The check should be case-insensitive. An empty string is considered valid and should return True
.
inputFormat
The input is read from standard input (stdin). The first line contains an integer \( T \) representing the number of test cases. Each of the following \( T \) lines contains a single key string.
outputFormat
For each test case, print True
if the key can be typed using letters from only one row of a QWERTY keyboard, otherwise print False
. Each result should be printed on a new line to standard output (stdout).
5
QWER
Hello
Typewriter
QQQQaaaa
True
True
False
True
False
</p>