import java.io.*;
import java.util.*;
class Sufrimientos2_1{
public static void main (String[] args) {
Scanner entrada = new Scanner (System.in);
String[]PALABRA={"cero","uno","dos","tres","cuatro","cinco","seis","siete","ocho","nueve","diez","once","doce","trece","catorce","quince","dieciceis","dieciciete","dieciocho","diecinueve","veinte","veinti","treinta","cuarenta","cincuenta","sesenta","setenta","ochenta","noventa","cien","ciento","doscientos","trescientos","cuatrocientos","quinientos","seiscientos","setecientos","ochocientos","novecientos","mil","millon","millones"};
long[]NUMEROS={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,20,30,40,50,60,70,80,90,100,100,200,300,400,500,600,700,800,900,1000,1000000,1000000};
String letras;
System.out.println("ingrese palabra a transformar");
letras=entrada.nextLine();
String []separa=letras.split("\s+");
int i;
String x0="",x1="",x2="",x3="",x4="",x5="";
for (i=0;i<separa.length;i++){
if (i==0){
x0=separa[0];}
if (i==1){
x0=separa[0];
x1=separa[1];}
if (i==2){
x0=separa[0];
x1=separa[1];
x2=separa[2];}
if (i==3){
x0=separa[0];
x1=separa[1];
x2=separa[2];
x3=separa[3];}
if (i==4){
x0=separa[0];
x1=separa[1];
x2=separa[2];
x3=separa[3];
x4=separa[4];}
if (i==5){
x0=separa[0];
x1=separa[1];
x2=separa[2];
x3=separa[3];
x4=separa[4];
x5=separa[5];}
}
System.out.println(x0);
System.out.println(x1);
System.out.println(x2);
System.out.println(x3);
System.out.println(x4);
System.out.println(x5);
long r=0,r2=0,acu=0;
for (i=0;i<NUMEROS.length;i++){
if (x0.equals(PALABRA)){
r=NUMEROS;
}
if (x1.equals(PALABRA)){
r2=NUMEROS;
}
acu=(r*r2);
}
long r3=0,acumula=0,r4=0,acux=0,r5=0;
for (i=0;i<NUMEROS.length;i++){
if (x2.equals(PALABRA)){
r3=NUMEROS;
}
if (x3.equals(PALABRA)){
r4=NUMEROS;
}
if (x4.equals(PALABRA)){
r5=NUMEROS;
}
acux=r3*1000;
}
System.out.println(r);
System.out.println(r2);
acumula=acu+acux+r4+r5;
System.out.println(acumula);
}
}
me corre pero por ejemplo para los veinti dos millones cuarenta y nueve
no o una cifra mas grande tengo una idea no habra alguna manera de que sea menos codigo saludos
aqui otro codigo pero tampoco me corre ayudaaa
ESTE ES MI OTRO CODIGO PERO TAMPOCO ME CORRE SE ME CAE CON LOS VEINTI Y LOS CIENTO
import java.io.*;
import java.util.*;
class Probar{
public static void main (String[] args) {
Scanner entrada = new Scanner (System.in);
String uno[]={"cero","un","uno","diez","cien","ciento","mil","diezmil","cienmil","unmillon","diezmillones","cienmillones"};
String dos[]={"cero","un","dos","veinte","ciento","doscientos","dosmil","veintemil","doscientosmil","dosmillones","veintemillones","doscientosmillones"};
String tres[]={"cero","un","tres","treinta","ciento","trescientos","tresmil","treintamil","trescientosmil","tresmillones","treintamillones","trescientosmillones"};
String cuatro[]={"cero","un","cuatro","cuarenta","ciento","cuatrocientos","cuatromil","cuarentamil","cuatrocientosmil","cuatromillones","cuarentamillones","cuatrocientosmillones"};
String cinco[]={"cero","un","cinco","cincuenta","ciento","quinientos","cincomil","cincuentamil","quinientosmil","cincomillones","ciencuentamillones","quinientosmillones"};
String seis[]={"cero","un","seis","sesenta","ciento","seiscientos","seismil","sesentamil","seiscientosnmil","seismillones","sesentamillones","seiscientosmillones"};
String siete[]={"cero","un","siete","setenta","ciento","setecientos","sietemil","setentamil","setecientosmil","sietemillones","setentamillones","setecientosmillones"};
String ocho[]={"cero","un","ocho","ochenta","ciento","ochocientos","ochomil","ochentamil","ochocientosmil","ochomillones","ochentamillones","ochocientosmillones"};
String nueve[]={"cero","un","nueve","noventa","ciento","novecientos","nuevemil","noventamil","novecientosmil","nuevemillones","noventamillones","novecientosmillones"};
String diez[]={"cero","un","once","doce","ciento","trece","catorce","quince","dieciceis","dieciciete","dieciocho","diecinueve"};
long a[]={0,1,1,10,100,100,1000,10000,100000,1000000,10000000,100000000};
long b[]={0,1,2,20,100,200,2000,20000,200000,2000000,20000000,200000000};
long c[]={0,1,3,30,100,300,3000,30000,300000,3000000,30000000,300000000};
long d[]={0,1,4,40,100,400,4000,40000,400000,4000000,40000000,400000000};
long e[]={0,1,5,50,100,500,5000,50000,500000,5000000,50000000,500000000};
long f[]={0,1,6,60,100,600,6000,60000,600000,6000000,60000000,600000000};
long g[]={0,1,7,70,100,700,7000,70000,700000,7000000,70000000,700000000};
long h[]={0,1,8,80,100,800,8000,80000,800000,8000000,80000000,800000000};
long j[]={0,1,9,90,100,900,9000,90000,900000,9000000,90000000,900000000
long k[]= {0,1,11,12,100,13,14,15,16,17,18,19};
String palabra;
String y="y";
System.out.println("ingrese palabra");
palabra=entrada.nextLine();
int i;
String []separa=palabra.split("\s+");
String x0="",x1="",x2="",x3="",x4="",x5="",x6="",x7="",x8="";
for (i=0;i<separa.length;i++){
if (i==0){
x0=separa[0];}
if (i==1){
x0=separa[0];
x1=separa[1];
}
if (i==2){
x0=separa[0];
x1=separa[1];
x2=separa[2];
}
if (i==3){
x0=separa[0];
x1=separa[1];
x2=separa[2];
x3=separa[3];
}
if (i==4){
x0=separa[0];
x1=separa[1];
x2=separa[2];
x3=separa[3];
x4=separa[4];
}
if (i==5){
x0=separa[0];
x1=separa[1];
x2=separa[2];
x3=separa[3];
x4=separa[4];
x5=separa[5];
}
if (i==6){
x0=separa[0];
x1=separa[1];
x2=separa[2];
x3=separa[3];
x4=separa[4];
x5=separa[5];
x6=separa[6];
}
if (i==7){
x0=separa[0];
x1=separa[1];
x2=separa[2];
x3=separa[3];
x4=separa[4];
x5=separa[5];
x6=separa[6];
x7=separa[7];
}
if (i=={
x0=separa[0];
x1=separa[1];
x2=separa[2];
x3=separa[3];
x4=separa[4];
x5=separa[5];
x6=separa[6];
x7=separa[7];
x8=separa[8];
}
if (y=="y"){
y="0";
}
}
System.out.println(x0);
System.out.println(x1);
System.out.println(x2);
System.out.println(x3);
System.out.println(x4);
System.out.println(x5);
System.out.println(x6);
System.out.println(x7);
System.out.println(x;
long r=0,r1=0,r2=0,r3=0,r4=0,r5=0,r6=0,r7=0,r8=0,r9=0,r10=0,r11=0,r12=0,r13=0,r14=0,r15=0,r16=0,r17=0,r18=0,r19=0,r20=0,r21=0,r22=0,r23=0,r24=0,r25=0,r26=0,r27=0,r28=0,r29=0,r30=0,r31=0,r32=0,r33=0,r34=0,r35=0,r36=0,r37=0,r38=0,r39=0,r40=0,r41=0,r42=0,r43=0,r44=0;
// 0 a 1000
long x[]=new long [a.length + b.length];
String xx[]=new String [uno.length + dos.length];
for (i=0;i<a.length;i++){
x=a;
xx=uno;
}
for (i=0;i<b.length;i++){
x[a.length+i]=b;
xx[uno.length+i]=dos;
}
for (i=0;i<xx.length;i++){
if (x0.equals(xx)){ // para el arreglo uno y dos
r=x;}
if (x1.equals(xx)){
r1=x;}
if (x2.equals(xx)){
r2=x;}
if (x3.equals(xx)){
r3=x;}
if (x4.equals(xx)){
r4=x;}
if (x5.equals(xx)){
r5=x;}
if (x6.equals(xx)){
r6=x;}
if (x7.equals(xx)){
r7=x;}
if (x8.equals(xx)){
r8=x;}
}
long xl[]=new long [c.length + d.length];
String xxx[]=new String [tres.length + cuatro.length];
for (i=0;i<c.length;i++){
xl=c;
xxx=tres;
}
for (i=0;i<d.length;i++){
xl[c.length+i]=d;
xxx[uno.length+i]=cuatro;
}
for (i=0;i<xxx.length;i++){
if (x0.equals(xxx)){ // para el arreglo tres y cuatro
r9=xl;}
if (x1.equals(xxx)){
r10=xl;}
if (x2.equals(xxx)){
r11=xl;}
if (x3.equals(xxx)){
r12=xl;}
if (x4.equals(xxx)){
r13=xl;}
if (x5.equals(xxx)){
r14=xl;}
if (x6.equals(xxx)){
r15=xl;}
if (x7.equals(xxx)){
r16=xl;}
if (x8.equals(xxx)){
r17=xl;}
}
long xll[]=new long [e.length + f.length];
String xxxx[]=new String [cinco.length + seis.length];
for (i=0;i<e.length;i++){
xll=e;
xxxx=cinco;
}
for (i=0;i<f.length;i++){
xll[e.length+i]=f;
xxxx[cinco.length+i]=seis;
}
for (i=0;i<xxxx.length;i++){
if (x0.equals(xxxx)){ // para el arreglo cinco y seis
r18=xll;}
if (x1.equals(xxxx)){
r19=xll;}
if (x2.equals(xxxx)){
r20=xll;}
if (x3.equals(xxxx)){
r21=xll;}
if (x4.equals(xxxx)){
r22=xll;}
if (x5.equals(xxxx)){
r23=xll;}
if (x6.equals(xxxx)){
r24=xll;}
if (x7.equals(xxxx)){
r25=xll;}
if (x8.equals(xxxx)){
r26=xll;}
}
long xlll[]=new long [h.length + j.length];
String xxxxx[]=new String [siete.length + ocho.length];
for (i=0;i<h.length;i++){
xlll=h;
xxxxx=siete;
}
for (i=0;i<f.length;i++){
xlll[h.length+i]=j;
xxxxx[siete.length+i]=ocho;
}
for (i=0;i<xxxxx.length;i++){
if (x0.equals(xxxxx)){ // para el arreglo siete y ocho
r27=xlll;}
if (x1.equals(xxxxx)){
r28=xlll;}
if (x2.equals(xxxxx)){
r29=xlll;}
if (x3.equals(xxxxx)){
r30=xlll;}
if (x4.equals(xxxxx)){
r31=xlll;}
if (x5.equals(xxxxx)){
r32=xlll;}
if (x6.equals(xxxxx)){
r33=xlll;}
if (x7.equals(xxxxx)){
r34=xlll;}
if (x8.equals(xxxxx)){
r35=xlll;}
}
long xllll[]=new long [j.length + k.length];
String xxxxxx[]=new String [nueve.length + diez.length];
for (i=0;i<j.length;i++){
xllll=j;
xxxxxx=nueve;
}
for (i=0;i<k.length;i++){
xllll[h.length+i]=k;
xxxxxx[siete.length+i]=diez;
}
for (i=0;i<xxxxx.length;i++){
if (x0.equals(xxxxxx)){ // para el arreglo nueve y diez
r36=xllll;}
if (x1.equals(xxxxxx)){
r37=xllll;}
if (x2.equals(xxxxxx)){
r38=xllll;}
if (x3.equals(xxxxxx)){
r39=xllll;}
if (x4.equals(xxxxxx)){
r40=xllll;}
if (x5.equals(xxxxxx)){
r41=xllll;}
if (x6.equals(xxxxxx)){
r42=xllll;}
if (x7.equals(xxxxxx)){
r43=xllll;}
if (x8.equals(xxxxxx)){
r44=xllll;}
}
// System.out.println(r);
System.out.println(r+r1+r2+r3+r4+r5+r6+r7+r8+r9+r10+r11+r12+r13+r14+r15+r16+r17+r18+r19+r20+r1+r22+r23+r24+r25+r26+r27+r28+r29+r30+r31+r32+r33+r34+r35+r36+r37+r38+r39+r40+r41+r42+r43+r44);
}
}
AYUDAAA