String Division
Practice
3.3 (105 votes)
Approved
Basic programming
Brute Force search
Easy
Ready
Problem
80% Success 9061 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

Kevin has a string S consisting of N lowercase English letters.

Kevin wants to split it into 4 pairwise different non-empty parts. For example, string "happynewyear" can be splitted into "happy", "new", "ye" and "ar". He can't delete any characters or change the order of the characters.

Help Kevin and find if there exist at least one possible spliting.

Input format:

The first line of input will contain an integer T, denoting the number of test cases. Each of the next T lines contains a string S.

Output format:

For every test case output "YES" if it is possible to split the string and "NO" otherwise.

Constraints:

  • 1 ≤ T ≤ 100
  • 1 ≤ N ≤ 1000
  • N ≤ 20 in test data worth 40% of all points

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
36 votes
Tags:
Ad-HocApprovedData StructuresEasyImplementationOpen
Points:20
33 votes
Tags:
ApprovedBasic ProgrammingEasyImplementationOpenString Manipulation
Points:20
14 votes
Tags:
AlgorithmsEasyHiringString Manipulation