Unity’s PlayerMaker plug -in Introduction -Affiliated Chinese Tutorial and Plug -in

2022-12-31   ES  

Question description

Niuke has a new employee Fish recently. Every morning, I always hold an English magazine and write some sentences on the book. The colleague Cat was very interested in the content of FISH. One day he borrowed it to Fish, but he couldn’t understand what it meant. For example, “Student. A am i”. Later, I realized that this guy turned out to the order of sentence words, and the correct sentence should be “I am a Student.”. The order of these words on Cat is not working on these words. Can you help him?

 

Here is to note: Although the order of the word in the sentence is wrong, the order of the letter in the word is correct, we cannot simply turn the entire string to flip It will become i ma a .tnetuts at this time we still need to turn each word over.

class solution { 

 public: 

 String Reversesentence (String Str) { 

 int left = 0; 

 int right = str.size () - 1; 

 While (left <right) 

 {{ 

 char test = str [left]; 

 str [left] = str [right]; 

 str [right] = temp; 

 left ++; 

 Right ---; 

 // Student. A am i 

 // I ma a .tneduts 

 } 

 int i = 0; 

 While (i <str.Size ())) 

 {{ 

 While (i <str.Size () && Str [i] == '') 

 i ++; 

 // I found the first position that is not a space 

 left = right = i; 

 While (i <str.Size () && Str [i]! = '') 

 {{ 

 i ++; 

 Right ++; 

 } 

 // Find the position of the space 

 Reverseword (Str, left, Right -1); 

 } 

 Return Str; 

 } 

 Void Reverseword (String & Str, Int left, int Right) 

 {{ 

 While (left <right) 

 {{ 

 char test = str [left]; 

 str [left] = str [right]; 

 str [right] = temp; 

 left ++; 

 Right ---; 

 } 

 } 

 };

Let’s turn the entire string first, and then start to flip each word. Each word ended in space. First find the first position that is not a space, and then find the position of the next space. The data between this is the word we want to flip again. Just twist it.

Here is to pay attention to whether it is a position that is not a space or a space, you have to judge whether he has visited the cross -border.

source

Related Posts

Virtualization deployment — Virtual machine installation of virtual machines, virtual machine management commands, virtual machine transmission in Linux system, virtual machine snapshot Rengar

Android version number and version name

npy/npz/PKL/CSV long string storage

Vue uses socketio real -time communication

Unity’s PlayerMaker plug -in Introduction -Affiliated Chinese Tutorial and Plug -in

Random Posts

HorizontalScrollView horizontal sliding menu

spark mllib python notebook configuration

pHP generate order number, Guid method

Financial One account TAAS platform continues to make efforts

C ++ conditional compilation instructions and DEFINED operator Change