Java tutorial
//package com.java2s; public class Main { public static String reduceGraphicalPassword(String password) { String returned = ""; for (int i = 0; i < password.length(); i++) { if (i == 0) { returned += password.charAt(i); continue; } if (password.charAt(i) != password.charAt(i - 1)) { returned += password.charAt(i); continue; } } return returned; } }