public class StringTransformation {
char [ ] s, t;
int [ ] [ ] [ ] dp;
int [ ] get;
public int findIt( int ss, int tt, int nex) {
if ( ss == - 1 && tt == - 1 ) return 1 ;
if ( ss < 0 || tt < 0 ) return 0 ;
if ( dp[ ss] [ tt] [ nex] != - 1 ) return dp[ ss] [ tt] [ nex] ;
dp[ ss] [ tt] [ nex] = 0 ;
if ( s[ ss] == t[ tt] ) dp[ ss] [ tt] [ nex] |= findIt( ss - 1 , tt - 1 , get[ s[ ss] ] ) ;
if ( ss < s.length - 1 && ss - 2 >= 0 && nex != get[ s[ ss - 2 ] ] && s[ ss - 1 ] == s[ ss] )
dp[ ss] [ tt] [ nex] |= findIt( ss - 2 , tt, nex) ;
return dp[ ss] [ tt] [ nex] ;
}
this .s = s.toCharArray ( ) ;
this .t = t.toCharArray ( ) ;
dp = new int [ this .s .length ] [ this .t .length ] [ 3 ] ;
get = new int [ 256 ] ;
get[ 'R' ] = 0 ;
get[ 'G' ] = 1 ;
get[ 'B' ] = 2 ;
for ( int i = 0 ; i < this .s .length ; i++ ) {
for ( int j = 0 ; j < this .t .length ; j++ ) {
}
}
int temp = 0 ;
temp |= findIt( this .s .length - 1 , this .t .length - 1 , 0 ) ;
temp |= findIt( this .s .length - 1 , this .t .length - 1 , 1 ) ;
temp |= findIt( this .s .length - 1 , this .t .length - 1 , 2 ) ;
if ( temp == 1 ) return "YES" ;
else return "NO" ;
}
}
cHVibGljIGNsYXNzIFN0cmluZ1RyYW5zZm9ybWF0aW9uIHsKICAgIGNoYXJbXSBzLCB0OwogICAgaW50W11bXVtdIGRwOwogICAgaW50W10gZ2V0OwoKICAgIHB1YmxpYyBpbnQgZmluZEl0KGludCBzcywgaW50IHR0LCBpbnQgbmV4KSB7CiAgICAgICAgaWYgKHNzID09IC0xICYmIHR0ID09IC0xKSByZXR1cm4gMTsKICAgICAgICBpZiAoc3MgPCAwIHx8IHR0IDwgMCkgcmV0dXJuIDA7CiAgICAgICAgaWYgKGRwW3NzXVt0dF1bb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MudC5sZW5ndGggLSAxLCAwKTsKICAgICAgICB0ZW1wIHw9IGZpbmRJdCh0aGlzLnMubGVuZ3RoIC0gMSwgdGhpcy50Lmxlbmd0aCAtIDEsIDEpOwogICAgICAgIHRlbXAgfD0gZmluZEl0KHRoaXMucy5sZW5ndGggLSAxLCB0aGlzLnQubGVuZ3RoIC0gMSwgMik7CiAgICAgICAgaWYgKHRlbXAgPT0gMSkgcmV0dXJuICJZRVMiOwogICAgICAgIGVsc2UgcmV0dXJuICJOTyI7CiAgICB9Cn0=
compilation info
Main.java:1: error: class StringTransformation is public, should be declared in a file named StringTransformation.java
public class StringTransformation {
^
Main.java:27: error: cannot find symbol
Arrays.fill(dp[i][j], -1);
^
symbol: variable Arrays
location: class StringTransformation
2 errors
stdout