1. 

/*Gruppe: Julius Tschannerl
David Leib
IF2C
*Problem: 484
*Status: Accepted
*Runtime: 0.670
*/

import java.io.*;
import java.util.*;

public class Main {

private static int[] bubbleSort(int[] a)
{
for (int i = 0; i < a.length -1; i++)
{
int bubble;
for (int j = i+1; j < a.length; j++)
{
if (a[i] == a[j])
{
bubble = a[j];
for (int k = j; k > i+1; k--)
{
a[k]= a[k-1];
}
a[i+1] = bubble;
}
}

}
return a;
}

public static void main(String... args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();

while (true)
{
String line = br.readLine();
if (line == null)
break;
sb.append(" "+line);
}

StringTokenizer st = new StringTokenizer(sb.toString());

int[] numbers = new int[st.countTokens()];

int index = 0;
while (st.hasMoreTokens())
{
numbers[index] = Integer.parseInt(st.nextToken());
index++;
}

bubbleSort(numbers);

int count = 1;

for (int i = 0; i < numbers.length-1; i+=count)
{
count = 1;
for (int j = i+1; j < numbers.length; j++)
{
if (numbers[i] == numbers[j])
count++;
}
System.out.println(numbers[i] + " " + count);
}
if (numbers[numbers.length-2] != numbers[numbers.length-1]);
System.out.println(numbers[numbers.length-1] + " " + "1");

System.exit(0);


}
}

2.

/* Robert Reichart
* Martin Pesl
* Elvin Uzeirovic

Run Time Submission Date
0.950 2009-03-19 16:18:48
*/
import java.io.*;

class Main{
public static void main(String...args) throws IOException{
//Einlesen des InputStreams und Abspeichern als ein langer String
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
StringBuilder eingabebuilder = new StringBuilder();

while (input.ready()){
if (eingabebuilder.length()==0){
eingabebuilder.append(input.readLine());
}
else {
if (eingabebuilder.charAt(eingabebuilder.length()-1)==' '){eingabebuilder.append(input.readLine());
} else {
eingabebuilder.append(" ");
eingabebuilder.append(input.readLine());
}


}
}
input.close();

String eingabe=eingabebuilder.toString();
//Einzelne Werte des Strings in ein Array speichern
String[] stringarray = eingabe.split(" ");

//String-Array-Werte in Integer Array-parsen
Integer[] werte = new Integer[stringarray.length];
for (int i=0; i<stringarray.length;i++){
werte[i]=Integer.parseInt(stringarray[i]);
}

//Auflistung aller benutzter Arrays
Integer[] content = new Integer[werte.length]; //Enthält welche werte vorkommen (NICHT WIE OFT!)
int contentindex=0;
Integer[] counter = new Integer [werte.length];

//Speichern in das Array "content" welche Werte überhaupt vorkommen
for (int i=0;i<werte.length;i++){
if(kommtvor(content,werte[i])== false){
content[contentindex]=werte[i];
contentindex++;
}
}


//Speichern der Häufigkeit der Werte
for (int i=0;i<content.length && content[i]!=null;i++){
counter[i]=countint(werte,content[i]);
}


//Ausgabe der Werte und ihrer Anzahl
for (int i=0;i<content.length && content[i]!=null;i++){
System.out.println(content[i] + " " + counter[i]);
}

}



static boolean kommtvor (Integer[] array,int a){
boolean returner = false;
for (int i=0;i<array.length && array[i]!=null;i++){
if (array[i]==a){
returner=true;
break;
}
}

return returner;
}

static int countint (Integer[] array,int a){
int count=0;
for (int i=0; i<array.length;i++){
if (array[i]==a){count++;}
}
return count;
}

}

3.

/*
* Seilbeck Robert, Miesel Christian, Wolfram André
* Runtime: 2.100 sec.
*/


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class P484 {

public static void main(String[] args) throws IOException {
//Einlesen des mehrzeiligen Inputs
BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
String tmp2 = reader.readLine();
StringBuilder sb=new StringBuilder();
while(tmp2!=null && tmp2.length()!=0){
sb.append(tmp2);
tmp2=reader.readLine();
}
String input=sb.toString();

//Zahlen einer ArrayList hinzufügen
ArrayList<String> numbers = new ArrayList<String>();

String[] tmp = input.split(" ");
for (int j = 0; j < tmp.length; j++) {
numbers.add(tmp[j]);
}

//Vorgang wird wiederholt, bis die Liste leer ist
while (numbers.isEmpty() == false) {
long count = 0;
ArrayList<Integer> position = new ArrayList<Integer>();

//die Häufigkeit der ersten Zahl zählen und die Positionen in einer ArrayList speichern...
for (int j = 0; j < numbers.size(); j++) {
if (numbers.get(0).equals(numbers.get(j))) {
count++;
position.add(j);

}
}
System.out.println(numbers.get(0) + " " + count);

//um sie hier aus der ArrayList zu löschen
for (int i = position.size() - 1; i >= 0; i--) {
numbers.remove(position.get(i).intValue());
}

}

}

}

4.

/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem #484 (Department of Redundancy Department)
* Link: http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=23&page=show_problem&problem=2113
*
* @author Hidir Sayli
* @author Lermer Florian
* @author Taskin Umut
*
* Status : Accepted
* Runtime: 2.640
*/


import java.util.ArrayList;
import java.util.Scanner;

public class Main {

/**
* @param args
* @throws IOException
*/
public static void main(String[] args)
{
ArrayList<Long> al=new ArrayList<Long>();
ArrayList<Long> al1=new ArrayList<Long>();
// TODO Auto-generated method stub

Scanner sc=new Scanner(System.in);
while(sc.hasNext())
al.add(sc.nextLong());
for (Long integer2 : al)
{
if(al1.contains(integer2))continue;
int count=0;
for(int x=0;x<al.size();x++)
{
if(integer2.equals(al.get(x)))
{
count++;
}
}
al1.add(integer2);
System.out.println(integer2+" "+count);
}
}



}

5.

/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem #484 (The Departament of Redundancy Departament )
* Link: http://icpcres.ecs.baylor.edu/onlinejudge/external/4/484.pdf
*
* @author Christian Posselt
* @author Jonathan Schubert
* @version 1.0, 03/25/2009
*
* Status : Accepted
* Runtime: 1.620
*/
import java.util.*;
import java.io.*;

public class Main
{
public static void main(String[] args) throws IOException
{
//Array list with all different chars
ArrayList<String> list = new ArrayList<String>();
Scanner scanner = new Scanner(System.in);
//Hashmap with key used char. Value is count of char in Input
Map<String, Integer> map = new HashMap<String, Integer>();
while(scanner.hasNext())
{
String key = scanner.next();
if(map.containsKey(key))
{
//found key in hasmap char is already known
int value = (map.get(key));
map.put(key,value+1);
}
else
map.put(key,1); //new not known char found
if(!list.contains(key))
list.add(key);
}
//run through the array containing the different chars from input in the right order and get the count of char from input
for (String string : list)
{
int value = map.get(string);
System.out.println(string+" "+value);
}
}
}