JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// El programa pide una cadena de caracteres y te da su longitud.
// Despues te pide que parte deseas mostrar por pantalla.
/*****************************************/
//The program asks for a string of characters and gives you its length.
// Then it asks you which part you want to show on the screen.
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String text ="",textdos ="";
int primer=0,segundo=0,largo=0;
System.out.println ("Introduzca un texto.");
System.out.println ("Enter a text: ");
text = in.nextLine();
largo = text.length();
//cargamos en la variable largo el largo de text.
//we load in the long variable the length of text.
System.out.println ("Introduzca dos valores para mostrar una parte del texto");
System.out.println ("Enter two values to show a part of the text");
primer = in.nextInt();
segundo = in.nextInt();
//Introducimos los datos para el substring
// We enter the data for the substring
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run