First, solve the problem. Then, write the code. ” - John Johnson

It's not at all important to get it right the first time. It's vitally important to get it right the last time. ” - Andrew Hunt and David Thomas

Wednesday, July 16, 2014

The Decoder.

Author : Jisan
Programming language : Java
Difficulty : A little Advance.
Status : Accepted
Problem number : UVA-458
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=399

Help: http://docs.oracle.com/javase/7/docs/api/java/io/DataInputStream.html and http://docs.oracle.com/javase/7/docs/api/java/io/DataOutputStream.html


Code:

import java.io.*;
public class Uva_458 {
  public static void main(String args[]) throws IOException{
 DataInputStream i=new DataInputStream(System.in);
 DataOutputStream o=new DataOutputStream(System.out);
 int M=0;
 while((M=i.read())!=-1){
 System.out.write((Character.isSpace((char)M)?M:(M-7)));
 }
  }
}

No comments:

Post a Comment