public class MakeTwoConsecutive {
for ( int i = 0 ; i < S.length ( ) - 1 ; ++ i)
if ( S.charAt ( i) == S.charAt ( i+ 1 ) )
return true ;
return false ;
}
for ( int i = 0 ; i < S.length ( ) ; ++ i)
if ( ok( S.substring ( 0 , i) + S.substring ( i+ 1 ) ) )
return "Possible" ;
return "Impossible" ;
}
}
cHVibGljIGNsYXNzIE1ha2VUd29Db25zZWN1dGl2ZSB7CgoJYm9vbGVhbiBvayhTdHJpbmcgUykgewoJCWZvcihpbnQgaSA9IDA7IGkgPCBTLmxlbmd0aCgpIC0gMTsgKytpKQoJCQlpZihTLmNoYXJBdChpKSA9PSBTLmNoYXJBdChpKzEpKQoJCQkJcmV0dXJuIHRydWU7CgkJcmV0dXJuIGZhbHNlOwoJfQoKCXB1YmxpYyBTdHJpbmcgc29sdmUoU3RyaW5nIFMpIHsKCQlmb3IoaW50IGkgPSAwOyBpIDwgUy5sZW5ndGgoKTsgKytpKQoJCQlpZihvayhTLnN1YnN0cmluZygwLCBpKSArIFMuc3Vic3RyaW5nKGkrMSkpKQoJCQkJcmV0dXJuICJQb3NzaWJsZSI7CgkJcmV0dXJuICJJbXBvc3NpYmxlIjsKCX0KfQ==