'How can I count how many target words can be made from the alphabet of a given string in Java?
There is a string s and an array of names l.
I want to count how many names of the given array with the characters of the string S can be created.
For example)
String s = "LILLYBILLYBOO";
String[] l = {"BILL", "MARIA", "LILLY"};
Through the alphabet of String s can make BILL twice, MARIA zero, LILLY once.
So the expected return value is {2,0,1}.
Is there any way to solve this problem with StringUtils or other methods other than splitting to all chars?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|