Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save byee01/639027 to your computer and use it in GitHub Desktop.
Save byee01/639027 to your computer and use it in GitHub Desktop.
A Java file.
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new URL(url).openStream());
Array tweet1 = getTweet(u1).split(); // ["word", "word", "word"]
Array tweet2 = getTweet(u2).split(); // ["word", "word", "word"]
StringBuilder mashedTweet = new StringBuilder();
mashedTweet.append(tweet1[0]);
for(int x = 1; x < tweet1.length; x++) mashedTweet.append(tweet1[x]);
for(int x = tweet2.length; x > tweet2.length/2; x--) mashedTweet.append(tweet2[x]);
return mashedTweet.toString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment