aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AceptaElReto/src/problemas/Problema484ElIncidenteDeDhahran.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/AceptaElReto/src/problemas/Problema484ElIncidenteDeDhahran.java b/AceptaElReto/src/problemas/Problema484ElIncidenteDeDhahran.java
new file mode 100644
index 0000000..88ba674
--- /dev/null
+++ b/AceptaElReto/src/problemas/Problema484ElIncidenteDeDhahran.java
@@ -0,0 +1,37 @@
+package problemas;
+
+public class Problema484ElIncidenteDeDhahran {
+
+ static java.util.Scanner in;
+
+ public static void main(String args[]) {
+ in = new java.util.Scanner(System.in);
+ String caso;
+ String[] partes;
+ String entera;
+ String decimal;
+ while (in.hasNext()) {
+ caso = in.nextLine();
+
+ partes = caso.split("\\.");
+
+ entera = partes[0];
+ entera = entera.replaceFirst("^0*", "");
+ if (entera.isEmpty())
+ System.out.print("0");
+ else
+ System.out.print(entera);
+
+ if (partes.length > 1) {
+ decimal = partes[1];
+ decimal = decimal.replaceAll("0*$", "");
+ if (decimal.isEmpty())
+ System.out.println();
+ else
+ System.out.println("." + decimal);
+ }
+ else
+ System.out.println();
+ }
+ }
+} \ No newline at end of file