题目描述
Given a string S, you have to check if we can split it into four strings such that each string is non-empty and distinct from each other.
Example 1:
Input :
S = "geeksforgeeks"
Output:
1
Explanation:
"geeks", "for", "gee", "ks" are four
distinct strings that can form from
given string.
Example 2:
Input:
S = "aaabb"
Output:
0
Explanation:
It's not possible to split string S in four
distinct strings
Your Task:
You don't need to read input or print anything. Your task is to complete the function isPossible() which takes the string S as input parameter and returns 1 if it's possible to split S into four strings such that each string is non-empty and distinct from each other or return 0 otherwise.
Expected Time Complexity: O(|S|^{3})
Expected Space Complexity: O(1)
Constraints:
1< |S| <=10000
输入格式
见题面
输出格式
见题面