UVa 490-rotating sentences

Source: Internet
Author: User

String water problem, rotate 90 degrees output. Note the length of the string and the processing of the whitespace.

Code

Import java.util.*;p Ublic class Main490 {public static void main (string[] args) {Scanner scan = new Scanner (system.in); cha r[][] str = new char[105][105]; String s;int[] length = new Int[105];int cnt = 0, Mlen = 0;while (Scan.hasnextline ()) {s = Scan.nextline (); str[cnt] = S.toc Hararray (); length[cnt] = S.length (); if (length[cnt] > Mlen) Mlen = length[cnt];cnt + +;} for (int i=0, i<mlen; i++) {for (int j=cnt-1; j>=0; j--) {if (Length[j] > i) System.out.print (Str[j][i]); ElseSystem.out.print ("");} System.out.println ();}}}


UVa 490-rotating sentences

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.