Kytcs.Blogspot.com: Java Iterations - Hands on 1

Java Iterations - Hands on 1

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
 public static void main(String args[] ) throws Exception {
 /* Enter your code here. Read input from STDIN. Print output to STDOUT */
 String str;
 Scanner scn=new Scanner(System.in);
 str=scn.next();
 int[] values=new int[str.length()];
 for(int i=0;i<str.length();i++)
 {
 values[i]=(int)(str.charAt(i));
 }
 int min=values[0];
 for(int i=0;i<values.length;i++)
 {
 if(values[i]<=min)
 min=values[i];
 }
 char c=(char)min;
 System.out.print(c);
 }
}

No comments:

Post a Comment

Followers

Ad Space