Skip to main content

Words formed by selecting one letter from each set (set combinations)






//Input 1,2   3,4,5  6  -1  each set is entered line-by-line
//-1 is the end of input
//output will be 136,146,156,236,246,256





import java.io.*;
import java.util.*;
import java.lang.String;
import java.util.StringTokenizer;
public class Possibilities {
    public static void main(String[] args) throws IOException {
        String s;
        ArrayList<String> a1 = new ArrayList<String>();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        s = br.readLine();
        if (!s.equals("-1"))
            a1 = generatePossibilities(s);
        System.out.println(a1);
    }

    public static ArrayList<String> generatePossibilities(String s)
            throws IOException
    {
        ArrayList<String> a1 = new ArrayList<String>();
        ArrayList<String> a2 = new ArrayList<String>();
        ArrayList<String> a3 = new ArrayList<String>();
        BufferedReader br1 = new BufferedReader(
                new InputStreamReader(System.in));
        String s2 = br1.readLine();
        if (!s2.equals("-1"))
        {
            a2 = generatePossibilities(s2);
            a3 = generateList(s);
            for (int l = 0; l < a3.size(); l++)
                for (int k = 0; k < a2.size(); k++)
                    a1.add(a3.get(l) + a2.get(k));
        }
        else
            a1 = generateList(s);

        return a1;
    }

    public static ArrayList<String> generateList(String s) throws IOException
    {
        ArrayList<String> a1 = new ArrayList<String>();
        StringTokenizer st = new StringTokenizer(s, ",");
        while (st.hasMoreTokens())
            a1.add(st.nextToken());

        return a1;
    }
}

Comments

Popular posts from this blog

Reverse Engineering : Extract contents from .img file

Unyaffs is a program to extract files from a YAFFS2 file system image. Currently it can only extract images created by mkyaffs2image. Download the source from here . Compiling : Extract the contents into a suitable place and run the following command make Usage : unyaffs [options] <image_file_name> [<extract_directory>] Options: -d detection of flash layout, no extraction -b spare contains bad block information -c <chunk size> set chunk size in KByte (default: autodetect, max: 16) -s <spare size> set spare size in Byte (default: autodetect, max: 512) -t list image contents -v verbose output -V print version Source: Official github repository

Mac Yosemite : Ugly turned out to be Uglier and Ugliest

You might have read my review on Mac OSX Yosemite , The Good, bad and ugly. Now it turned out to be UGLIEST. No more words. Here's the image. If you are on Yosemite, you might be familiar with it. Most of the times, you get stuck on boot logo. I've seen complaints regarding it saying that fellow members are ignorant of it and they deny such possibility, even though many are still facing it. Workarounds suggested by our online friends: Just reboot your mac as many times it takes to your desktop. Boot into safe mode, by holding SHIFT and then reboot. Comment your workaround below, mine is the first one. If you are still on Mavericks, be there till Apple provides a fix for this.

Reverse Engineering : Android Dex files to Class files

In my previous post, we have seen how to extract the contents of img file . After extraction, you will find that most of the files have ".dex" extension. These are Compiled Android application code files. In order to convert them into executable format (.class or .jar), you can use dex2jar tool. Extract it to a proper location and open the terminal to this location. Now run the following command: ./d2j-dex2jar.sh <Path-to-dex_file> It will bundle the dex files into a jar file, and stores it in the current directory. dex2jar can also be used to convert dex files into variuos other formats. For detailed info, click here .