Quna written test real string decompression

Source: Internet
Author: User

Quna written test real string decompression

Personal information: studied at Yan University undergraduate software engineering major at present;

I blog: Google search "cqs_2012" can be;

Personal Hobbies: Love data structure and algorithms, hope to work in the future algorithm to make their own contribution to the people;

Programming language: Java;

Programming bad Environment: Windows 8.1 x64;

Programming tools: Eclipse;

Cartographic tools: Office PowerPoint;

Hardware information: ASUS X54HR notebook;

Love situation: In the first kiss in the courtship;



Title: Give a string, such as A1B2C3AB10, to convert it to a abbcccabababababababababab conversion rule, presumably.
Ideas: string extraction, digital extraction
Code: (Java)
Package Wxj_string;public class Main {public static void main (string[] args) {//TODO auto-generated method Stubmain m = n EW Main (); String str = m.strunzip ("A1b2c3ab10"); System.out.println (str);} public string Strunzip (String str) {string result = ""; int i,j;for (i=0;i<str.length ();) {/* * * intercepts the substring containing the letter */for (j=i;; J + +) {if (Str.charat (j) >= ' 0 ' && Str.charat (j) <= ' 9 ') break;} String data = Str.substring (i,j); i = j;/* * intercepts substrings containing numbers */for (j=i;; J + +) {if (J >= str.length () | | | Str.charat (j) < ' 0 ' | | str.charat (j) > ' 9 ') break; String num = str.substring (i,j), i = j;/* * Extract string */int n = integer.parseint (num), for (; n>0;n--) {result + = data;}} return result;}}





Quna written test real string decompression

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.