ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • war game
    과거...../icpc 문제 2010. 5. 12. 21:28

    풀이소스

     import java.util.Scanner;

    public class abcd {

     public static void main(String[] args) {
      
      Scanner input = new Scanner(System.in);
      int a1;
      int bi1,bi2;
      String c1,c1_c;
      String c2="";
      String c3="";
      
      a1 = input.nextInt();
      
      for(bi1=0;bi1<a1;bi1++){
       c1 = input.next();
       for(bi2=0;bi2 < c1.toString().length();bi2++){
        if(c1.toString().substring(c1.toString().length()-bi2-1,c1.toString().length()-bi2).contains("a")){
         c2 = c2 + "c";
        }else if(c1.toString().substring(c1.toString().length()-bi2-1,c1.toString().length()-bi2).contains("b")){
         c2 = c2 + "a";
        }else if(c1.toString().substring(c1.toString().length()-bi2-1,c1.toString().length()-bi2).contains("c")){
         c2 = c2 + "b";
        }
       }
       /*System.out.println(c2.toString());*/
       for(bi2=0;bi2 < c2.toString().length()-1;bi2++){
        if(c2.toString().substring(bi2,bi2+1).contains(c2.toString().substring(bi2+1,bi2+2))){
              
        }else{
         c3 = c3 + c2.toString().substring(bi2,bi2+1);     
        }     
       }
       c3 = c3 + c2.toString().substring(bi2,bi2+1) + c2.toString().substring(c2.toString().length(),c2.toString().length()) ;
       
       System.out.println(c3.toString());
      }
     }

    }


     영어라는것이 무척 짜증났던 문제임


Designed by Tistory.