/* Given a String variable s, write a code segment that outputs each letter in the string twice. For example, if s = "Hello", the code should output "HHeelllloo". */ import java.util.Scanner; public class HW4q2d { public static void main(String[] args) { Scanner kb=new Scanner(System.in); String userStr=kb.nextLine(); int length=userStr.length(); int pos=0; while (length>pos) { System.out.print(userStr.charAt(pos)); System.out.print(userStr.charAt(pos)); pos++; } System.out.println(); } }