Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package deciphername;
- public class DecipherName {
- public static void main(String[] args) {
- String number = "86232316280027192";
- int MagicNumber = Integer.parseInt(number.substring(0, 1));
- StringBuilder sb = new StringBuilder(number);
- sb.replace(0, 1, "");
- sb.reverse();
- System.out.println(sb.toString());
- String alphabet = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя";
- StringBuilder output = new StringBuilder();
- String CurrentSym = "";
- while (!sb.toString().equals("")) {
- if (sb.length() != 1) {
- CurrentSym = sb.substring(0, 2);
- sb.replace(0, 2, "");
- System.out.println(sb.toString() + " " + sb.length());
- } else {
- CurrentSym = sb.substring(0, 1);
- sb.replace(0, 1, "");
- }
- int CurrentIndex = Integer.parseInt(CurrentSym) - MagicNumber;
- char ElementChar = alphabet.charAt(CurrentIndex);
- output.append(ElementChar);
- }
- System.out.println(output.toString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement