Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static List<Integer> FussyDiplomats(List<String> inputs) {
- List<Integer> result = new ArrayList<Integer>();
- for (String input : inputs) {
- int count = 0;
- String tmp = input;
- while (tmp.length() > 0) {
- int day_count = 0;
- int i = 0;
- while (i < tmp.length()) {
- if (tmp.charAt(i) == input.charAt(i)) {
- day_count++;
- i++;
- } else {
- break;
- }
- }
- System.out.println(day_count);
- count += day_count;
- tmp = tmp.substring(1);
- }
- result.add(count);
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement