Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class Task1881 implements Runnable {
- private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
- private BufferedReader in;
- private PrintWriter out;
- private StringTokenizer tok = new StringTokenizer("");
- private void init() throws FileNotFoundException {
- Locale.setDefault(Locale.US);
- String fileName = "";
- if (ONLINE_JUDGE && fileName.isEmpty()) {
- in = new BufferedReader(new InputStreamReader(System.in));
- out = new PrintWriter(System.out);
- } else {
- if (fileName.isEmpty()) {
- in = new BufferedReader(new FileReader("input.txt"));
- out = new PrintWriter("output.txt");
- } else {
- in = new BufferedReader(new FileReader(fileName + ".in"));
- out = new PrintWriter(fileName + ".out");
- }
- }
- }
- String readString() {
- while (!tok.hasMoreTokens()) {
- try {
- tok = new StringTokenizer(in.readLine());
- } catch (Exception e) {
- return null;
- }
- }
- return tok.nextToken();
- }
- int readInt() {
- return Integer.parseInt(readString());
- }
- long readLong() {
- return Long.parseLong(readString());
- }
- double readDouble() {
- return Double.parseDouble(readString());
- }
- public static void main(String[] args) {
- //new Thread(null, new _Solution(), "", 128 * (1L << 20)).start();
- new Task1881().run();
- }
- @Override
- public void run() {
- try {
- init();
- solve();
- out.close();
- } catch (Exception e) {
- e.printStackTrace();
- System.exit(-1);
- }
- }
- private void solve() throws IOException {
- char[] c = in.readLine().toCharArray();
- for(int i = 0; i < c.length; i++){
- c[i]-=97;
- }
- if (c[0] - 5 < 0) {
- c[0] += 26;
- }
- for(int i = 1; i < c.length; i++){
- if (c[i] < c[i-1]){
- while(c[i] < c[i-1]){
- c[i]+=26;
- }
- }
- }
- for(int i = c.length - 1; i > 0; i--){
- c[i] -= c[i-1];
- }
- c[0] -= 5;
- for(int i = 0; i < c.length; i++){
- c[i]+=97;
- }
- for(int i = 0; i < c.length; i++){
- out.print(c[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement