Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private boolean duplicate(String username, String msg) {
- if(!messages.containsKey(username)){
- return false;
- }
- char[] c = msg.toCharArray();
- char[] m = messages.get(username).toCharArray();
- int i = 0;
- int o = 0;
- int max = m.length;
- for(char ca : c){
- if(i == max) break;
- if(ca == m[i]){
- o++;
- }
- i++;
- }
- return o > (max/2);
- }
- the cat ran across the street
- the cat ran across the street asgdjogsdjg
- the cat ran across the street
- asdf the cat ran across the street
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement