Home > AI > Language > Java > String >

iterate each character in string

Example:

import java.util.*;

class Solution{

    public static void main(String []argh)
    {
        Scanner sc = new Scanner(System.in);

        while (sc.hasNext()) {
            String input = sc.next();

            //Complete the code
            System.out.printf(input);

            for (int i=0; i<input.length(); i++) {
                char c = input.charAt(i);
            }

        }

    }
}
Related posts:

Leave a Reply