For more information, see http://scarboroughsubwayextension.ca
Do not include any personal information as all posted material on this site is considered to be part of a public record as defined by section 27 of the Municipal Freedom of Information and Protection of Privacy Act.
We reserve the right to remove inappropriate comments. Please see Terms of Use for City of Toronto Social Media Sites at http://www.toronto.ca/e-updates/termsofuse.htm.
For more information, see http://scarboroughsubwayextension.ca
Do not include any personal information as all posted material on this site is considered to be part of a public record as defined by section 27 of the Municipal Freedom of Information and Protection of Privacy Act.
We reserve the right to remove inappropriate comments. Please see Terms of Use for City of Toronto Social Media Sites at http://www.toronto.ca/e-updates/termsofuse.htm.
3. +
Example
まずR を入れる。R
次にG を左から入れる。GR
B を右から入れる。GRB
G を右から入れる。GRBG
G を右から入れる。GRBGG
この時G が揃うので消える。GRB
B を右から入れる。GRBB
この時B が揃うので消える。GR
G を左から入れる。GGR
この時G が揃うので消える。R
B を左から入れる。BR
R を右から入れる。BRR
この時R が揃うので消える。B
よってB が1つ残るので、答えは1である
4. +
SourceCode
import java.util.Scanner;
//import java.util.stream.IntStream;
/**
* Created by nullzine on 2014/11/24.
*/
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = Integer.parseInt(sc.nextLine());
String data = sc.nextLine();
if(data.length()==n){
System.out.println(new Execution(data).getAnswer());
}else{
System.out.println("ERROR");
}
}
}
class Execution{
private String data;
private String result;
public Execution(String data){
this.data=deleteProcessing(data);
result=null;
calculation();
}