Felix Halim .NET  
University Experience
IOI 2002 Yong In, Korea
ACM ICPC Regional Manila 2003
ACM ICPC Regional Manila 2004
ACM ICPC Regional Manila 2005
ACM ICPC Regional Kaohsiung 2006
ACM ICPC Regional Singapore 2007
ACM ICPC Regional Jakarta 2008 (ext)
ACM ICPC Regional Jakarta 2009 (ext)
ACM ICPC Regional Jakarta 2010
ACM ICPC Regional Jakarta 2012  Problem H
ACM ICPC Regional Jakarta 2013  Problem J (new!)
ACM ICPC World Final Tokyo 2007
Google India Code Jam 2005
Google India Code Jam 2006
Indonesia National Contest 2007
Indonesia National Contest 2008
Indonesia National Contest 2010
Facebook Hacker Cup 2011


ACM/ICPC Indonesia National Contest 2007Problem AMinimum SwapTime Limit: 1sSorting a sequence either into ascending or descending order is a common problem in real world. One of the most common methods in sorting algorithm is comparing and swapping any two elements in the sequence. Supposed I have invented a new sorting algorithm which uses this swapping method. I need to compare the number of swaps occurred in my algorithm with the minimum number of swaps that actually needed to sort some sequences. Help me determine the minimum number of swaps needed to transform a sequence of characters into a sorted sequence in ascending order. In this problem, you may assume that each character will appear at most once in the sequence. InputEach line contains a sequence of lowercase characters S (1 <=  S  <= 26). There will be no repeated characters in S and each ith character (0 < i <  S ) is in range ['a'...'z']. Input is terminated by EOF.OutputFor each test case, output a line containing the minimum number of swaps to transform it into a sorted sequence of characters in ascending order.Sample Inputabc cba acb bdca fedcba Sample Output0 1 1 2 3 Problem Setter: Lego Haryanto Kembali ke pembahasan soal ini Lihat problem lain: 