Naruto and Madara
All submissions for this problem are available.
Madara Uchiha is back to take revenge from Naruto Uzumaki because Naruto defeated Madara in Great Ninja War. This time Madara has acquired unlimited power. In order to defeat Madara, Naruto must use a special type of Jutsu which requires a String ‘S’. This String can only contain lower case alphabets (a-z) but it has a constraint on number of alphabets.
Number of a in the string: 1
Number of b in the string: 2
Number of z in the string: 26
Help Naruto in defeating Madara..
The first line contains a single integer T, the number of test cases. T test cases follow. Each test case consists of a single line consisting of a single String S.
For each test case, output “YES” for Valid String and “NO” for Invalid String.
- 1 ≤ T ≤ 1000
- 1 ≤ |S| ≤ 1000
Input: abb ab a Output: YES NO YES
For First Test Case. Number of a=1, Number of b=2. Therefore, This is a valid String
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, JAR, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions