Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- import java.util.*;
- import java.lang.*;
- import java.io.*;
- public class Elementary {
- // Don't place your source in a package
- // Please name your class Main
- HashMap<Character, List<Character>> adding;
- HashMap<Character, List<Character>> reducing;
- public static void main(String[] args) throws java.lang.Exception {
- Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
- int[] initValues = {0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0};
- char[][] data = {
- /*a*/{'/','/','+','/','/','/','+','/','/','/','/','+','+','/','/','/','/','+','+','+','+','/','/','/','/','/'},
- /*b*/{'/','/','/','-','/','/','-','+','+','-','+','-','-','/','/','/','-','/','/','-','/','/','/','-','/','-'},
- /*c*/{'/','/','/','/','/','+','-','/','/','-','/','/','/','+','+','/','-','/','+','-','+','/','/','-','/','-'},
- /*d*/{'/','+','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','+','/','/','/','/','/','+','/'},
- /*e*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','+','+','/','+','/','/','/','/','/'},
- /*f*/{'-','/','/','-','/','/','-','/','/','-','/','/','/','/','/','/','-','/','/','-','/','/','/','-','/','-'},
- /*g*/{'+','/','/','+','+','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'},
- /*h*/{'-','/','/','-','/','+','/','/','/','-','/','-','-','/','+','/','-','-','+','-','/','/','/','-','/','-'},
- /*i*/{'-','/','/','-','-','/','-','/','/','-','/','-','-','+','/','/','-','/','/','-','/','/','/','-','/','-'},
- /*j*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'},
- /*k*/{'-','/','/','-','-','/','-','/','/','-','/','-','-','/','/','/','-','/','/','-','/','/','/','-','/','-'},
- /*l*/{'+','/','/','/','/','/','/','/','+','/','/','/','/','/','/','/','/','+','/','/','+','+','/','/','/','/'},
- /*m*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'},
- /*n*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'},
- /*o*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'},
- /*p*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'},
- /*q*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'},
- /*r*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'},
- /*s*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'},
- /*t*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'},
- /*u*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'},
- /*v*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'},
- /*w*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'},
- /*x*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'},
- /*y*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'},
- /*z*/{'/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/','/'}};
- int n = in.nextInt();
- long cntr = 0;
- for (int t = 0; t < n; t++) {
- String currStr = in.next();
- int len = currStr.length();
- cntr = initValues[currStr.charAt(0) - 'a'];
- for (int i = 0; i < len-1; i++) {
- for (int j = i + 1; j < i + 2; j++) {
- char currChar = currStr.charAt(i);
- char nextChar = currStr.charAt(j);
- if(data[currChar-'a'][nextChar-'a']=='+'){
- cntr ++;
- }else if(data[currChar-'a'][nextChar-'a']=='-'){
- cntr --;
- }
- System.out.println(currChar + " " + nextChar);
- }
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement