You are not logged in. Please login at www.codechef.com to post your questions!

×

how to divide strings

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 Sample Input(Plaintext Link) 2 ababca aaabb Sample Output(Plaintext Link) YES NO

asked 03 Jan '16, 21:24

arpit728's gravatar image

1★arpit728
6831868
accept rate: 10%


dont answer this question its a question from ongoing contest in hackerearth

link

answered 03 Jan '16, 22:37

tihorsharma123's gravatar image

2★tihorsharma123
49718
accept rate: 15%

Answer is hidden as author is suspended. Click here to view.

answered 04 Jan '16, 03:49

sarvagya3943's gravatar image

4★sarvagya3943
(suspended)
accept rate: 36%

link

answered 20 Jan '16, 11:33

computaholics's gravatar image

0★computaholics
14
accept rate: 11%

Here is a c program to split a string. We can use the same algorithm to solve this c program also.

link

answered 07 Apr '17, 13:59

gmiller's gravatar image

0★gmiller
1
accept rate: 0%

Answer is hidden as author is suspended. Click here to view.

answered 09 Apr '17, 15:08

ardentcoder's gravatar image

2★ardentcoder
(suspended)
accept rate: 15%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×1,664
×1,409
×354

question asked: 03 Jan '16, 21:24

question was seen: 6,063 times

last updated: 09 Apr '17, 15:08