public static String commonSuffix(String a, String b) {
    int i = 0;
    while (i < a.length() && i < b.length() && a.charAt(a.length()-1-i) == b.charAt(b.length()-1-i))
      ++i;
    return a.substring(a.length()-i);
  }
Snippet is not live.
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #2000379 | 
| Snippet name: | commonSuffix | 
| Eternal ID of this version: | #2000379/1 | 
| Text MD5: | 16b0e425c823160efc26853bf26d356c | 
| Author: | stefan | 
| Category: | |
| Type: | New Tinybrain snippet | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2015-06-22 21:02:01 | 
| Source code size: | 233 bytes / 6 lines | 
| Pitched / IR pitched: | No / Yes | 
| Views / Downloads: | 760 / 1552 | 
| Referenced in: | [show references] |