string s of length n (1≤n≤26) is called sequential on the off chance that it very well may be gotten utilizing the accompanying calculation: to begin with, compose a vacant string to s (for example play out the task s := ""); then, at that point, play out the following stage n times; at the I-th step take I-th lowercase letter of the Latin letters in order and compose it either to the left of

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Correct answer will upvoted else downvoted.

 

string s of length n (1≤n≤26) is called sequential on the off chance that it very well may be gotten utilizing the accompanying calculation: to begin with, compose a vacant string to s (for example play out the task s := ""); then, at that point, play out the following stage n times; at the I-th step take I-th lowercase letter of the Latin letters in order and compose it either to the left of the string s or to the right of the string s (for example play out the task s := c+s or s := s+c, where c is the I-th letter of the Latin letters in order). 

 

At the end of the day, emphasize over the n first letters of the Latin letter set beginning from 'a' and so on Each time we prepend a letter to the left of the string s or annex a letter to the right of the string s. Strings that can be gotten in that manner are in sequential order. For instance, the accompanying strings are in sequential order: "a", "ba", "stomach muscle", "bac" and "ihfcbadeg". The accompanying strings are not in order: "z", "aa", "ca", "acb", "xyz" and "ddcba". From the given string, decide whether it is sequential. 

Input :The principal line contains one integer t (1≤t≤104) — the number of experiments. Then, at that point, t experiments follow. Each experiment is composed on a different line that contains one string s. String s comprises of lowercase letters of the Latin letters in order and has a length somewhere in the range of 1 and 26, comprehensive. 

Output :Output t lines, every one of them should contain the response to the relating experiment. Output YES if the given string s is sequential and NO in any case. You can output YES and NO regardless (for instance, strings yEs, indeed, Yes and YES will be perceived as a positive reply).

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education